libqasm
library for handling cQASM files
|
Exception used for analysis errors. More...
Public Member Functions | |
AnalysisError (std::string &&message="", const tree::Annotatable *node=nullptr) | |
Constructs a new error. More... | |
void | context (const tree::Annotatable &node) |
Sets the context of this error to the SourceLocation annotation of the given node, if the error doesn't already have such a context. More... | |
const std::string & | get_message () const |
Constructs the message string. More... | |
const char * | what () const noexcept override |
Returns the message exception-style. More... | |
Public Attributes | |
std::ostringstream | message |
The stringstream used to construct the message. More... | |
std::unique_ptr< annotations::SourceLocation > | location |
Attached location in the source file, if any. More... | |
Exception used for analysis errors.
Contains a message in the form of an std::ostringstream
that can be appended to or otherwise modified even after the initial throw to add information, as well as an optional source location object.
Definition at line 27 of file cqasm-error.hpp.
#include <cqasm-error.hpp>
|
explicit |
Constructs a new error.
If node is a non-null annotatable with a location node, its location information is attached.
Definition at line 14 of file cqasm-error.cpp.
void cqasm::error::AnalysisError::context | ( | const tree::Annotatable & | node | ) |
Sets the context of this error to the SourceLocation annotation of the given node, if the error doesn't already have such a context.
If it does, this is no-op.
Definition at line 29 of file cqasm-error.cpp.
const std::string & cqasm::error::AnalysisError::get_message | ( | ) | const |
Constructs the message string.
Definition at line 40 of file cqasm-error.cpp.
|
overridenoexcept |
Returns the message exception-style.
Definition at line 54 of file cqasm-error.cpp.
std::ostringstream cqasm::error::AnalysisError::message |
The stringstream used to construct the message.
Additional information can be appended after construction.
Definition at line 41 of file cqasm-error.hpp.
std::unique_ptr<annotations::SourceLocation> cqasm::error::AnalysisError::location |
Attached location in the source file, if any.
Definition at line 46 of file cqasm-error.hpp.