iris::Error Class Reference
Doxygen 1.15.0 generates this reference during each site build from the public headers. The C++ guide shows the API in use.
A language error with the members of the canonical error document (Specification §3.7), and everything its diagnostic shows. More...
#include <iris/error.hpp>
Public Member Functions | |
| Error (ErrorCode code, std::string message, ErrorDetails details={}) | |
| An error with the code code, the message message and the parts details. | |
| ErrorCode | code () const |
| Return the error code. | |
| const std::string & | message () const |
| Return the message, without a location. | |
| const ErrorDetails & | details () const |
| Return the parts besides the code and message. | |
| const std::optional< Location > & | input_location () const |
| Return where in the input the error is, for a read-time error. | |
| const std::optional< Location > & | spec_location () const |
| Return where in the reader spec the error is: the statement that runs for a read-time error. | |
| const std::optional< std::string > & | excerpt () const |
| Return the input line at the input location (see ErrorDetails). | |
| const std::optional< std::string > & | context () const |
| Return the statements that run, outermost first (see ErrorDetails). | |
| const std::optional< std::vector< std::size_t > > & | record_path () const |
| The failed check's witness, outermost index first and counted from 0, or no path for an error that is not a failed check. | |
| const std::optional< std::string > & | earlier_rejection () const |
| Return the summary of an earlier rejection in the same instance, which may explain this error. | |
| const std::optional< std::source_location > & | call_site () const |
| Return the host code that wrote the statement the error belongs to, for a reader spec from a spec builder; a spec parsed from text has no call sites. | |
Detailed Description
A language error with the members of the canonical error document (Specification §3.7), and everything its diagnostic shows.
what() renders the diagnostic of Specification §11.1: it starts with origin:line:column: message, or origin:line: message without a column. A read-time error goes on with the excerpt and a caret under the column, then while reading: and the context, spec: origin:line for the statement, call site: file:line:column for the call site, and after an earlier error in the instance: and the earlier rejection, each on a line of its own if the error has it.
Constructor & Destructor Documentation
Error()
| iris::Error::Error | ( | ErrorCode | code, |
| std::string | message, | ||
| ErrorDetails | details = {} ) |
Member Function Documentation
call_site()
|
inlinenodiscard |
Return the host code that wrote the statement the error belongs to, for a reader spec from a spec builder; a spec parsed from text has no call sites.
code()
|
inlinenodiscard |
Return the error code.
context()
|
inlinenodiscard |
Return the statements that run, outermost first (see ErrorDetails).
details()
|
inlinenodiscard |
Return the parts besides the code and message.
earlier_rejection()
|
inlinenodiscard |
Return the summary of an earlier rejection in the same instance, which may explain this error.
excerpt()
|
inlinenodiscard |
Return the input line at the input location (see ErrorDetails).
input_location()
|
inlinenodiscard |
Return where in the input the error is, for a read-time error.
message()
|
inlinenodiscard |
Return the message, without a location.
record_path()
|
inlinenodiscard |
The failed check's witness, outermost index first and counted from 0, or no path for an error that is not a failed check.
spec_location()
|
inlinenodiscard |
Return where in the reader spec the error is: the statement that runs for a read-time error.