Audacity 3.2.0
InconsistencyException.h
Go to the documentation of this file.
1
9#ifndef __AUDACITY_INCONSISTENCY_EXCEPTION__
10#define __AUDACITY_INCONSISTENCY_EXCEPTION__
11
12#include "AudacityException.h"
13
15
23class EXCEPTIONS_API InconsistencyException final : public MessageBoxException
24{
25public:
27 : MessageBoxException{ ExceptionType::Internal, XO ("Internal Error") }
28 {}
29
32 const char *fn,
33 const char *f,
34 unsigned l
35 )
36 : MessageBoxException { ExceptionType::Internal, XO("Internal Error") }
37 , func { fn }, file { f }, line { l }
38 {}
39
42 , func{ that.func }
43 , file{ that.file }
44 , line{ that.line }
45 {}
46
47 ~InconsistencyException() override;
48
49 unsigned GetLine() const { return line; }
50
51private:
52 // Format a default, internationalized error message for this exception.
53 TranslatableString ErrorMessage() const override;
54
55 const char *func {};
56 const char *file {};
57 unsigned line {};
58};
59
60#ifdef __func__
61
62#define CONSTRUCT_INCONSISTENCY_EXCEPTION \
63 InconsistencyException( __func__, __FILE__ , __LINE__ )
64
65#else
66
71#define CONSTRUCT_INCONSISTENCY_EXCEPTION \
72 InconsistencyException( "", __FILE__ , __LINE__ )
73
74#endif
75
79#define THROW_INCONSISTENCY_EXCEPTION throw CONSTRUCT_INCONSISTENCY_EXCEPTION
80
81#endif
Declare abstract class AudacityException, some often-used subclasses, and GuardedCall.
ExceptionType
A type of an exception.
@ Internal
Indicates internal failure from Audacity.
XO("Cut/Copy/Paste")
static const auto fn
Exception that should be impossible in production, thrown only from provably unreachable places.
InconsistencyException(const char *fn, const char *f, unsigned l)
Don't call this directly but use CONSTRUCT_INCONSISTENCY_EXCEPTION or THROW_INCONSISTENCY_EXCEPTION.
InconsistencyException(const InconsistencyException &that)
Abstract AudacityException subclass displays a message, specified by further subclass.
virtual TranslatableString ErrorMessage() const =0
Format the error message for this exception.
Holds a msgid for the translation catalog; may also bind format arguments.