libnmbs 1.0.0
Loading...
Searching...
No Matches
nmbs::Error Class Reference

Lightweight domain error container for use with nmbs::Expected. More...

#include <nmbs/expected.h>

Public Member Functions

 Error ()=delete
 Default constructor is explicitly deleted.
 Error (Error &&) noexcept=default
 Default move constructor.
Error & operator= (Error &&) noexcept=default
 Default move assignment operator.
 Error (const Error &)=default
 Default copy constructor.
Error & operator= (const Error &)=default
 Default copy assignment operator.
ExitCode code () const
 Retrieves the underlying error code.
const std::string & message () const
 Retrieves the descriptive error message.

Static Public Member Functions

static Error unexpected (std::string message="An unexpected error occurred")
 Creates an unknown error.
static Error file_not_found (std::string message="Requested resource could not be found")
 Creates a file not found error.
static Error xmp_not_found (std::string message="Requested resource did not contain any XMP data (at all)")
 Creates an XMP data missing error.
static Error xmp_key_not_found (std::string message="Requested resource did not contain the desired XMP key")
 Creates an XMP key missing error.
static Error xml_could_not_parse (std::string message="Requested XML could not be read")
 Creates an XML parsing error.
static Error xml_could_not_create_xpath_context (std::string message="Requested XML could not be read")
 Creates an XML XPath context error.
static Error no_binding_support (std::string message="Requested file does not support any supported binding mechanism")
 Creates an unsupported binding error.

Detailed Description

Lightweight domain error container for use with nmbs::Expected.

Provides an nmbs::ExitCode for programmatic error handling. Instances are immutable and must be created via static factory functions:

auto err = nmbs::Error::file_not_found();
Since
1.0.0
See also
nmbs::Error::message
nmbs::Error::code

Constructor & Destructor Documentation

◆ Error() [1/3]

nmbs::Error::Error ( )
delete

Default constructor is explicitly deleted.

Since
1.0.0

◆ Error() [2/3]

nmbs::Error::Error ( Error && )
defaultnoexcept

Default move constructor.

Since
1.0.0

◆ Error() [3/3]

nmbs::Error::Error ( const Error & )
default

Default copy constructor.

Since
1.0.0

Member Function Documentation

◆ code()

ExitCode nmbs::Error::code ( ) const
inlinenodiscard

Retrieves the underlying error code.

Returns
The associated nmbs::ExitCode.
Since
1.0.0

◆ file_not_found()

Error nmbs::Error::file_not_found ( std::string message = "Requested resource could not be found")
inlinestatic

Creates a file not found error.

Parameters
messageOptional custom error description.
Since
1.0.0

◆ message()

const std::string & nmbs::Error::message ( ) const
inlinenodiscard

Retrieves the descriptive error message.

Returns
A const reference to the message string.
Since
1.0.0

◆ no_binding_support()

Error nmbs::Error::no_binding_support ( std::string message = "Requested file does not support any supported binding mechanism")
inlinestatic

Creates an unsupported binding error.

Parameters
messageOptional custom error description.
Since
1.0.0

◆ operator=() [1/2]

Error & nmbs::Error::operator= ( const Error & )
default

Default copy assignment operator.

Since
1.0.0

◆ operator=() [2/2]

Error & nmbs::Error::operator= ( Error && )
defaultnoexcept

Default move assignment operator.

Since
1.0.0

◆ unexpected()

Error nmbs::Error::unexpected ( std::string message = "An unexpected error occurred")
inlinestatic

Creates an unknown error.

Parameters
messageOptional custom error description.
Since
1.0.0

◆ xml_could_not_create_xpath_context()

Error nmbs::Error::xml_could_not_create_xpath_context ( std::string message = "Requested XML could not be read")
inlinestatic

Creates an XML XPath context error.

Parameters
messageOptional custom error description.
Since
1.0.0

◆ xml_could_not_parse()

Error nmbs::Error::xml_could_not_parse ( std::string message = "Requested XML could not be read")
inlinestatic

Creates an XML parsing error.

Parameters
messageOptional custom error description.
Since
1.0.0

◆ xmp_key_not_found()

Error nmbs::Error::xmp_key_not_found ( std::string message = "Requested resource did not contain the desired XMP key")
inlinestatic

Creates an XMP key missing error.

Parameters
messageOptional custom error description.
Since
1.0.0

◆ xmp_not_found()

Error nmbs::Error::xmp_not_found ( std::string message = "Requested resource did not contain any XMP data (at all)")
inlinestatic

Creates an XMP data missing error.

Parameters
messageOptional custom error description.
Since
1.0.0

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