errors 0.6.3
Loading...
Searching...
No Matches
errors::impl::wrap_error Class Reference

An error which wraps another error. More...

#include <errors/impl/wrap_error.hpp>

Inheritance diagram for errors::impl::wrap_error:
Collaboration diagram for errors::impl::wrap_error:

Public Member Functions

 wrap_error (error_ptr &&cause, source_location loc)
 Constructor with cause and source_location.
 
 wrap_error (std::string msg, error_ptr &&cause, source_location loc)
 Constructor with message, cause and source_location.
 
const char * what () const noexcept override
 Get error message.
 
- Public Member Functions inherited from errors::impl::error_with_cause
 error_with_cause (error_ptr &&cause, source_location loc)
 Constructor with source_location.
 
const error_ptrcause () const &noexcept override
 Get cause of this error, if any.
 
error_ptr cause () &&noexcept override
 Transfer the ownership of cause of this error, if any.
 
- Public Member Functions inherited from errors::impl::base_error
 base_error (source_location loc)
 Constructor with source_location.
 
std::optional< source_locationlocation () const noexcept override
 Get the source location of this error, if any.
 
- Public Member Functions inherited from errors::error
- Public Member Functions inherited from errors::detail::interface
 interface (const interface &)=delete
 
 interface (interface &&)=delete
 
interfaceoperator= (interface &&)=delete
 
interfaceoperator= (const interface &)=delete
 

Detailed Description

An error which wraps another error.

This error is used to wrap another error with an optional message. If the message is not provided, the only extra information that this error will records is the source location.

See also
errors::wrap

Constructor & Destructor Documentation

◆ wrap_error() [1/2]

errors::impl::wrap_error::wrap_error ( error_ptr && cause,
source_location loc )
inline

Constructor with cause and source_location.

Parameters
causeThe cause of the error.
locThe source location.

◆ wrap_error() [2/2]

errors::impl::wrap_error::wrap_error ( std::string msg,
error_ptr && cause,
source_location loc )
inline

Constructor with message, cause and source_location.

Parameters
msgThe error message.
causeThe cause of the error.
locThe source location.

Member Function Documentation

◆ what()

const char * errors::impl::wrap_error::what ( ) const
inlineoverridevirtualnoexcept

Get error message.

Returns
A c-style string, which is an error message. It should never be 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.

Implements errors::error.


The documentation for this class was generated from the following file: