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

A base error class. More...

#include <errors/impl/error_with_cause.hpp>

Inheritance diagram for errors::impl::error_with_cause:
Collaboration diagram for errors::impl::error_with_cause:

Public Member Functions

 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
virtual const char * what () const noexcept=0
 Get error message.
 
- Public Member Functions inherited from errors::detail::interface
 interface (const interface &)=delete
 
 interface (interface &&)=delete
 
interfaceoperator= (interface &&)=delete
 
interfaceoperator= (const interface &)=delete
 

Detailed Description

A base error class.

It implements the cause method for all other builtin error types which have a cause to derived from.

Constructor & Destructor Documentation

◆ error_with_cause()

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

Constructor with source_location.

Parameters
locThe source location.
causeThe cause of the error.

Member Function Documentation

◆ cause() [1/2]

error_ptr errors::impl::error_with_cause::cause ( ) &&
inlineoverridevirtualnoexcept

Transfer the ownership of cause of this error, if any.

Returns
A smart pointer holds the cause of current error, or a nullptr if there is no cause

This method is used to transfer the ownership of the cause, use with caution.

Implements errors::error.

◆ cause() [2/2]

const error_ptr & errors::impl::error_with_cause::cause ( ) const &
inlineoverridevirtualnoexcept

Get cause of this error, if any.

Returns
Reference to a smart pointer which holds the cause of current error, or a nullptr if there is no cause.

Implements errors::error.


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