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

An error that has a message. More...

#include <errors/impl/runtime_error.hpp>

Inheritance diagram for errors::impl::runtime_error:
Collaboration diagram for errors::impl::runtime_error:

Public Member Functions

 runtime_error (std::string msg, source_location loc)
 Constructor with message and source_location.
 
const char * what () const noexcept override
 Get error message.
 
- Public Member Functions inherited from errors::impl::error_without_cause
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.
 
 base_error (source_location loc)
 Constructor with source_location.
 
- 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
 

Public Attributes

std::string message
 The error message.
 

Detailed Description

An error that has a message.

This class is used to create an error that has a message.

Examples
examples/basic-usage/src/main.cpp.

Constructor & Destructor Documentation

◆ runtime_error()

errors::impl::runtime_error::runtime_error ( std::string msg,
source_location loc )
inline

Constructor with message and source_location.

Parameters
msgThe message.
locThe source location.

Member Function Documentation

◆ what()

const char * errors::impl::runtime_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: