What do you do in unhandledException?

I enabled JUCE_CATCH_UNHANDLED_EXCEPTIONS.
I try to manage exceptions properly between threads.
I end up with handling all of them to an unhandledException call.
But now what to do? Currently i’m just asserting…

void unhandledException (const std::exception*, const juce::String& file, int line) override
{
    DBG (file + juce::String (line)); jassertfalse;
}

…but in release mode, i guess that the application should be stopped.

  • Using std::terminate?
  • Using systemRequestedQuit?
  • Throwing another (custom) exception?

What is your/the best startegy?

1st) find the code and add checks so it doesn’t throw
2nd) handle the exception, if there is anything that allows the code to continue (rarely the case)
3rd) add a crash handler that sends you the data, unless you are a plugin (in that case the various crash handlers of all the plugins would collide, so only the host should add a crash handler)

1 Like

1./ I don’t have any exception for now. It is speculative thoughts about managing them properly.
2./ I’m agree. Rarely the case to figure out what to do with things broken.
3./ Could be possible into released product, but i’m a dude that don’t like telemetry.

After more thinking, and since i want usefull core dumps, i feel like the best think to do is to not catch exceptions at all (even into spawned threads). Afterall i really don’t know what to do once catched!

1 Like