1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-22 15:20:15 +02:00

Intercept exceptions in command script, report failure.

This commit is contained in:
Paul Licameli 2017-03-15 11:33:04 -04:00
parent d11027c2a7
commit a8a2598ba3

View File

@ -20,6 +20,7 @@ ApplyAndSendResponse, and CommandImplementation classes
#include <wx/variant.h> #include <wx/variant.h>
#include <wx/arrstr.h> #include <wx/arrstr.h>
#include "../AudacityException.h"
#include "Validators.h" #include "Validators.h"
#include "CommandType.h" #include "CommandType.h"
#include "CommandMisc.h" #include "CommandMisc.h"
@ -71,7 +72,9 @@ bool DecoratedCommand::SetParameter(const wxString &paramName,
bool ApplyAndSendResponse::Apply(CommandExecutionContext context) bool ApplyAndSendResponse::Apply(CommandExecutionContext context)
{ {
bool result = mCommand->Apply(context); auto result = GuardedCall<bool>(
[&] { return mCommand->Apply(context); }
);
wxString response = GetName(); wxString response = GetName();
// These three strings are deliberately not localised. // These three strings are deliberately not localised.
// They are used in script responses and always happen in English. // They are used in script responses and always happen in English.