Unhandled exception in DLL and robot exits with code 0

Hello,

my assumption for robot framework is, that at any kind of error in the robot process at least the return code of the robot process indicates an (fatal) error.

But what I see is that after an error (see below) the test runs until its end, status FAIL gets written to the XML output file and then “everything aborts” (-> no more logs, XML file incomplete) and process return code is 0, which means “All tests passed.”.

The error that occurs happens this way:

  1. Robot test script calls python keyword
  2. python code calls via ctypes a function in DLL, written in C, compiled with MSVC
  3. The DLL starts multiple threads via Win32 API
  4. One of these threads uses a NULL pointer. This leads to an unhandled “read access violation” exception.
  5. After that robot behaves as written above

Should robot framework be able to handle that gracefully? For example somehow catch this exception and exit with return code -1.

My solution is to register a handler in the DLL for unhandled exceptions via Win32 function SetUnhandledExceptionFilter() and calling exit(-1) in this handler. This works reliably.

Is there a better solution to handle such errors gracefully?
Or can robot framework be enabled to handle such errors gracefully?

Best regards
Christian