how to use JUCE_CATCH_UNHANDLED_EXCEPTIONS in plugin?


#1

Hi, jules
How are you?
I want to catch the exceptions in plugin , and report them to log. I saw the following definition in juce_Config.h.
/** Enable this to turn on juce’s internal catching of exceptions.

Turning it off will avoid any exception catching. With it on, all exceptions
are passed to the JUCEApplication::unhandledException() callback for logging.

*/
#ifndef JUCE_CATCH_UNHANDLED_EXCEPTIONS
#define JUCE_CATCH_UNHANDLED_EXCEPTIONS 1
#endif

However, plugin does not use JUCEApplication, so how can I use this exception catch in plugin?

Thanks!
Leon


#2

You can’t use it in a plugin. In an app it’s used to wrap the message dispatcher and catch any exceptions that get thrown when messages are processed. But in a plugin, the host performs the message dispatching, so we have nowhere to hook it in.