How to catch an error in KnownPluginList::scanAndAddFile()?


#1

When opening the Sylenth1 plugin in debug mode i get an error that this is not possible and the Juce application is not usable anymore:

Attempting to load VST: /Library/Audio/Plug-Ins/VST/Sylenth1.vst
2017-04-14 17:56:02.985652 JuceGui[69656:10212801] CFUserNotificationDisplayAlert: called from main application thread, will block waiting for a response.
*** Leaked objects detected: 1 instance(s) of class ModuleHandle
JUCE Assertion failure in juce_LeakedObjectDetector.h:97

My question is: Can i catch such a message from the VST plugin when trying to open it without having to restart the whole application? I use the following code, where the error happens in the bold line:
> KnownPluginList plist;
> OwnedArrayjuce::PluginDescription pluginDescriptions;
> juce::VSTPluginFormat format;
> plist.scanAndAddFile(synth->pluginPath, true, pluginDescriptions, format);
> if (pluginDescriptions.size() > 0) { … }

Neither a try/catch nor JUCE_TRY seem to help here. Internally Juce tries to instantiate that VST plugin, whereat any error is not propagated to my code so that i have the possibility to catch it.

Thanks for your help and how i can make my code more safe.


#2

I haven’t found a way to have TRY/CATCH work in a separate thread

I did start another forum thread a few weeks ago here which may be a good central place to discuss this topic.

I have a separate process doing the scanning and I’ve devised a method for the calling app to restart the scanner tool if it detects no activity for a set period… (and the scanner picks up from where it left off) but no method of actually trapping any exceptions.

Rail


#3

Thank you Rail!
Good to know i’m not alone with that problem :slight_smile:
If there’s nothing to catch for us i think such a problem should be catched safely by the Juce framework and then propagated to our calling line.
But let’s see if the creators of Juce have another idea or opinion…