Add dedicated Exception for Plugin/Processor errors

This commit is contained in:
Robin Gareus 2023-12-15 00:34:08 +01:00
parent 5476aa336f
commit 88c796c8f2
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
3 changed files with 18 additions and 0 deletions

View File

@ -45,6 +45,18 @@ namespace ARDOUR {
class Location;
class Session;
class LIBARDOUR_API ProcessorException: public std::exception
{
public:
explicit ProcessorException (const std::string msg) : _message(msg) {}
virtual ~ProcessorException () throw() {}
virtual const char* what() const throw() { return _message.c_str(); }
private:
std::string _message;
};
/** A mixer strip element - plugin, send, meter, etc */
class LIBARDOUR_API Processor : public SessionObject, public Automatable, public Latent
{

View File

@ -461,6 +461,9 @@ Session::Session (AudioEngine &eng,
case -6:
throw SessionException (string_compose (_("Cannot initialize session/engine: %1"), _("Audio/MIDI Engine is not running or sample-rate mismatches.")));
break;
case -8:
throw SessionException (string_compose (_("Cannot initialize session/engine: %1"), _("Required Plugin/Processor is missing.")));
break;
default:
throw SessionException (string_compose (_("Cannot initialize session/engine: %1"), _("Unexpected exception during session setup, possibly invalid audio/midi engine parameters. Please see stdout/stderr for details")));
break;

View File

@ -381,6 +381,9 @@ Session::post_engine_init ()
} catch (AudioEngine::PortRegistrationFailure& err) {
error << err.what() << endmsg;
return -5;
} catch (ProcessorException const & e) {
error << e.what() << endmsg;
return -8;
} catch (std::exception const & e) {
error << _("Unexpected exception during session setup: ") << e.what() << endmsg;
return -6;