Closed MikeSchulze closed 1 week ago
Reopen, because of correct caught exceptions are reported as failure.
try
{
if (frameCount == 5)
throw new InvalidProgramException("Exception during scene processing inside a catch block");
}
catch (InvalidProgramException)
{
// ignore
}
Discussed in https://github.com/MikeSchulze/gdUnit4Net/discussions/148
Background
By default, Godot intercepts all exceptions triggered by the runtime within the scene tree processing in order to avoid unexpected program crashes. All caught exceptions are just logged as error in the Godot log.
GodotSharp.dll
Install an exception hook
We can hook into the Godot exception to add a custom exception handler that will cause a test to fail. The test should fail with the stacktrace to the original exception
Update
We do now monitor thrown exception in combination of Godot log parsing to detect uncaught exceptions. To enable the exception monitoring, there are now two new attributes as can be used.