Audacity 3.2.0
|
Declare abstract class AudacityException, some often-used subclasses, and GuardedCall. More...
Go to the source code of this file.
Classes | |
class | AudacityException |
Base class for exceptions specially processed by the application. More... | |
class | MessageBoxException |
Abstract AudacityException subclass displays a message, specified by further subclass. More... | |
class | SimpleMessageBoxException |
A MessageBoxException that shows a given, unvarying string. More... | |
struct | SimpleGuard< R > |
A default template parameter for GuardedCall<R> More... | |
struct | SimpleGuard< bool > |
Specialization of SimpleGuard, also defining a default value. More... | |
struct | SimpleGuard< void > |
Specialization of SimpleGuard, also defining a default value. More... | |
Enumerations | |
enum class | ExceptionType { Internal , BadUserAction , BadEnvironment } |
A type of an exception. More... | |
Functions | |
void | DefaultDelayedHandlerAction (AudacityException *pException) |
A default template parameter for GuardedCall. More... | |
template<typename R > | |
SimpleGuard< R > | MakeSimpleGuard (R value) noexcept(noexcept(SimpleGuard< R >{ value })) |
Convert a value to a handler function returning that value, suitable for GuardedCall<R> More... | |
SimpleGuard< void > | MakeSimpleGuard () noexcept |
Convert a value to a no-op handler function, suitable for GuardedCall<void> More... | |
template<typename R = void, typename F1 , typename F2 = SimpleGuard< R >, typename F3 = void (*)(AudacityException *pException)> | |
R | GuardedCall (const F1 &body, const F2 &handler=F2::Default(), F3 delayedHandler=DefaultDelayedHandlerAction) noexcept(noexcept(handler(std::declval< AudacityException * >())) &&noexcept(handler(nullptr)) &&noexcept(std::function< void(AudacityException *)>{std::move(delayedHandler)})) |
Execute some code on any thread; catch any AudacityException; enqueue error report on the main thread. More... | |
Declare abstract class AudacityException, some often-used subclasses, and GuardedCall.
Audacity: A Digital Audio Editor
Paul Licameli
Definition in file AudacityException.h.
|
strong |
A type of an exception.
Definition at line 21 of file AudacityException.h.
|
inline |
A default template parameter for GuardedCall.
Definition at line 123 of file AudacityException.h.
References AudacityException::DelayedHandlerAction().
Referenced by AudioIO::DrainRecordBuffers().
|
noexcept |
Execute some code on any thread; catch any AudacityException; enqueue error report on the main thread.
Executes a given function (typically a lamba), in any thread.
If there is any exception, can invoke another given function as handler, which may rethrow that or another exception, but usually just returns the value for the GuardedCall.
If AudacityException is handled, then it queues up a delayed handler action for execution later in the event loop at idle time, on the main thread; typically this informs the user of the error.
The default delayed handler action is simply to invoke a method of the AudacityException, but this too can be specified otherwise by a third function.
R | Return type, defaulted to void, or else the only explicit template parameter |
F1 | deduced type of body function; takes no arguments, returns R |
F2 | deduced type of handler function, or defaulted to SimpleGuard<R>; takes pointer to AudacityException, which is null when some other type of exception is caught; return value is converted to R |
F3 | deduced type of delayed handler function, if a nondefault argument is given; takes pointer to AudacityException, return value is unused |
nothing,when | handler throws nothing and delayedHandler is defaulted |
body | typically a lambda |
handler | default just returns false or void; see also MakeSimpleGuard |
delayedHandler | called later in the main thread, passing it a stored exception; usually defaulted |
Definition at line 207 of file AudacityException.h.
Referenced by MacroCommands::ApplyMacro(), DBConnection::CheckpointThread(), AudioIO::DrainRecordBuffers(), FFmpegPresets::ExportPresets(), AUPImportFileHandle::HandleImport(), KeyConfigPrefs::OnExport(), TagsEditorDialog::OnSave(), PCMExportProcessor::Process(), ProjectFSCK(), EQCurveWriter::SaveCurves(), AudioIO::StopStream(), FFmpegPresets::~FFmpegPresets(), SqliteSampleBlock::~SqliteSampleBlock(), and XMLFileWriter::~XMLFileWriter().
|
inlinenoexcept |
Convert a value to a no-op handler function, suitable for GuardedCall<void>
Definition at line 172 of file AudacityException.h.
|
noexcept |
Convert a value to a handler function returning that value, suitable for GuardedCall<R>
Definition at line 167 of file AudacityException.h.
Referenced by ExecCallback(), and NyquistBase::NyxContext::PutCallback().