StormByte 2.0.0
C++26 foundation of the StormByte suite
 
Loading...
Searching...
No Matches
StormByte::Error::Fault Class Reference

Held error: an std::error_code and a StormByte::CString message. More...

#include <StormByte/error.hxx>

Public Member Functions

Life
 Fault () noexcept
 Success.
 
 Fault (const std::error_code &code)
 From an std::error_code.
 
template<Described Enum>
 Fault (Enum e)
 From a described enumerator.
 
 Fault (const Fault &other)=default
 Copy constructor.
 
 Fault (Fault &&other) noexcept=default
 Move constructor.
 
 ~Fault () noexcept=default
 Destructor.
 
Fault & operator= (const Fault &other)=default
 Copy assignment.
 
Fault & operator= (Fault &&other) noexcept=default
 Move assignment.
 
Observers
const std::error_code & code () const noexcept
 Held code.
 
const char * what () const noexcept
 Owned message (category: message).
 
 operator bool () const noexcept
 Whether this is an error.
 

Detailed Description

Held error: an std::error_code and a StormByte::CString message.

Used as object state (File, tube Fail). Not thrown. operator bool is true when the code is an error.

Constructor & Destructor Documentation

◆ Fault() [1/5]

StormByte::Error::Fault::Fault ( )
noexcept

Success.

◆ Fault() [2/5]

StormByte::Error::Fault::Fault ( const std::error_code &  code)
explicit

From an std::error_code.

Parameters
codeCode to hold.

◆ Fault() [3/5]

template<Described Enum>
StormByte::Error::Fault::Fault ( Enum  e)
inlineexplicit

From a described enumerator.

Template Parameters
EnumEnum described by StormByte::Error::Domain.
Parameters
eEnumerator.

Uses ADL make_error_code(e) so the module singleton category is the one stored in the code.

◆ Fault() [4/5]

StormByte::Error::Fault::Fault ( const Fault &  other)
default

Copy constructor.

Parameters
otherFault to copy.

◆ Fault() [5/5]

StormByte::Error::Fault::Fault ( Fault &&  other)
defaultnoexcept

Move constructor.

Parameters
otherFault to take.

◆ ~Fault()

StormByte::Error::Fault::~Fault ( )
defaultnoexcept

Destructor.

Member Function Documentation

◆ code()

const std::error_code & StormByte::Error::Fault::code ( ) const
noexcept

Held code.

Returns
Code.

◆ operator bool()

StormByte::Error::Fault::operator bool ( ) const
explicitnoexcept

Whether this is an error.

Returns
true if the held code is non-zero.

◆ operator=() [1/2]

Fault & StormByte::Error::Fault::operator= ( const Fault &  other)
default

Copy assignment.

Parameters
otherFault to copy.
Returns
*this.

◆ operator=() [2/2]

Fault & StormByte::Error::Fault::operator= ( Fault &&  other)
defaultnoexcept

Move assignment.

Parameters
otherFault to take.
Returns
*this.

◆ what()

const char * StormByte::Error::Fault::what ( ) const
noexcept

Owned message (category: message).

Returns
NUL-terminated text owned by this object.

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