JUCEApplication::initialiseApp() doesn’t catch exceptions and forward them to the application object during the call to initialise(). I believe the function should look like this:
bool JUCEApplication::initialiseApp (const String& commandLine)
{
//....
// let the app do its setting-up..
JUCE_TRY
{
initialise (commandLineParameters);
}
JUCE_CATCH_EXCEPTION
//....
return true;
}
It seemed to fix my problem, I correctly get JUCEApplication::unhandledException() called for the case where an exception is thrown during initialization.
I’m not sure if there should be a try/catch there. If your code throws an unhandled exception during startup, the kindest thing to do is to let it die immediately.
I guess there’s an argument for adding a catch so that the exception logging code can record it, but I certainly wouldn’t want to use JUCE_CATCH_EXCEPTION, it’d need to be a special case where it logs the exception, and then kills the app instead of letting it carry on.
I dislike exceptions, so in my app they are only used to indicate a fatal condition.
I handle the exception in the JUCEApplication override by showing an alert and then quitting.
I suppose, if the try/catch isn’t going to be in JUCEApplication::initialiseApp then I can just put it in my initialise() function, so thats a perfectly workable solution for me.