40 AssertionFailure::AssertionFailure(
const string& condition,
const string& msg)
41 : condition_(condition),
42 message_(msg.empty() ? (
"Assertion failed: " + condition) : msg)
47 : condition_(orig.condition_), message_(orig.message_)
51 AssertionFailure::~AssertionFailure() {}
53 const char* AssertionFailure::what() const noexcept
55 return message_.c_str();
59 OSError::OSError(
const string& message,
const string& description)
60 : message_(message), description_(description),
61 completeMessage_(message +
": " + description)
65 OSError::OSError(
const OSError& orig)
66 : message_(orig.message_), description_(orig.description_),
67 completeMessage_(orig.completeMessage_)
71 OSError::~OSError() {}
76 << Bytestream::Error <<
"OS error"
77 << Bytestream::Reset <<
": " << message_ <<
": "
78 << Bytestream::ErrorMessage << description_
84 UserError::UserError(
const string& message)
89 UserError::UserError(
const UserError& orig)
90 : message_(orig.message_)
94 UserError::~UserError() {}
98 out << Bytestream::ErrorMessage << message_ << Bytestream::Reset;
102 SourceCodeException::SourceCodeException(
const string& m,
const SourceRange& l)
108 :
HasSource(orig.source()), err_(orig.err_)
112 SourceCodeException::~SourceCodeException()
116 const string& SourceCodeException::message()
const
118 return err_->getMessage();
121 const char* SourceCodeException::what() const noexcept
123 return message().c_str();
128 err_->PrettyPrint(out, indent);
132 SyntaxError::SyntaxError(
const string& message,
const SourceRange& loc)
142 SyntaxError::~SyntaxError() {}
144 SemanticException::SemanticException(
const string& m,
const SourceRange& loc)
149 SemanticException::~SemanticException() {}
virtual void PrettyPrint(Bytestream &, size_t indent=0) const
Print a human-readable representation to an output stream and return that output stream.
Base class for exceptions related to invalid source code.
Some code may choose to throw this exception rather than assert() out.
An error that has an OS-specific description.
A mixin type for something that has a location in source code.
Declaration of basic Fabrique exceptions.
virtual void PrettyPrint(Bytestream &, size_t indent=0) const override
Print a human-readable representation to an output stream and return that output stream.
A non-exceptional representation of a problem in source code.
virtual void PrettyPrint(Bytestream &, size_t indent=0) const override
Print a human-readable representation to an output stream and return that output stream.
A syntactic error is present in the Fabrique description.
A ostream-like class that may support formatting.
A range of characters in source code.
Declaration of fabrique::ErrorReport.
Declaration of fabrique::Bytestream.