Audacity  3.0.3
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 
23 class AUDACITY_DLL_API InconsistencyException final : public MessageBoxException
24 {
25 public:
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 
41  : MessageBoxException(std::move(that))
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 
51 private:
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
TranslatableString
Holds a msgid for the translation catalog; may also bind format arguments.
Definition: TranslatableString.h:32
fn
static const auto fn
Definition: WaveformView.cpp:1102
InconsistencyException::InconsistencyException
InconsistencyException(const char *fn, const char *f, unsigned l)
Don't call this directly but use CONSTRUCT_INCONSISTENCY_EXCEPTION or THROW_INCONSISTENCY_EXCEPTION.
Definition: InconsistencyException.h:31
InconsistencyException
Exception that should be impossible in production, thrown only from provably unreachable places.
Definition: InconsistencyException.h:24
XO
#define XO(s)
Definition: Internat.h:31
InconsistencyException::GetLine
unsigned GetLine() const
Definition: InconsistencyException.h:49
MessageBoxException::ErrorMessage
virtual TranslatableString ErrorMessage() const =0
Format the error message for this exception.
InconsistencyException::InconsistencyException
InconsistencyException(InconsistencyException &&that)
Definition: InconsistencyException.h:40
AudacityException.h
Declare abstract class AudacityException, some often-used subclasses, and GuardedCall.
MessageBoxException
Abstract AudacityException subclass displays a message, specified by further subclass.
Definition: AudacityException.h:58
ExceptionType::Internal
@ Internal
Indicates internal failure from Audacity.
InconsistencyException::InconsistencyException
InconsistencyException()
Definition: InconsistencyException.h:26