errors 0.6.3
|
Interface representing an error. More...
#include <errors/error.hpp>
Public Member Functions | |
virtual const char * | what () const noexcept=0 |
Get error message. | |
virtual const error_ptr & | cause () const &noexcept=0 |
Get cause of this error, if any. | |
virtual error_ptr | cause () &&noexcept=0 |
Transfer the ownership of cause of this error, if any. | |
virtual std::optional< source_location > | location () const noexcept=0 |
Get the source location of this error, if any. | |
![]() | |
interface (const interface &)=delete | |
interface (interface &&)=delete | |
interface & | operator= (interface &&)=delete |
interface & | operator= (const interface &)=delete |
Interface representing an error.
This interface class represents an error with an optional source location where it was generated and an optional cause.
|
nodiscardpure virtualnoexcept |
Transfer the ownership of cause of this error, if any.
nullptr
if there is no causeThis method is used to transfer the ownership of the cause, use with caution.
Implemented in errors::impl::error_with_cause, and errors::impl::error_without_cause.
|
nodiscardpure virtualnoexcept |
Get cause of this error, if any.
nullptr
if there is no cause. Implemented in errors::impl::error_with_cause, and errors::impl::error_without_cause.
|
nodiscardpure virtualnoexcept |
Get the source location of this error, if any.
This method returns the source location where this error is generated, if it is available.
Implemented in errors::impl::base_error.
|
nodiscardpure virtualnoexcept |
Get error message.
NULL
, but it can be an empty string.This method works just like std::exception::what
, you should print all the context which is useful for debugging in this method except for the source location.
Implemented in errors::impl::code_error< Code >, errors::impl::code_error< int >, errors::impl::exception_error, errors::impl::runtime_error, and errors::impl::wrap_error.