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

A simple error container to use with nmbs::expected for communicating domain issues to function callers. More...

#include <nmbs/expected.h>

Public Member Functions

 Error ()=delete
 Error (Error &&) noexcept=default
Error & operator= (Error &&) noexcept=default
 Error (const Error &)=default
Error & operator= (const Error &)=default
ExitCode code () const
const std::string & message () const

Static Public Member Functions

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

Detailed Description

A simple error container to use with nmbs::expected for communicating domain issues to function callers.

Intended to be small and lightweight. A nmbs::exit_code is provided to better enable logic to be built on top of specific errors. Static factory functions are provided to support in generating errors. e.g.

The constructors are private, and the produced instances are immutable with only const accessors being provided. Copy constructors, including move support are provided.

Since
1.0.0
See also
nmbs::error::message
nmbs::error::code

Constructor & Destructor Documentation

◆ Error() [1/3]

nmbs::Error::Error ( )
delete

◆ Error() [2/3]

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

◆ Error() [3/3]

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

Member Function Documentation

◆ code()

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

◆ file_not_found()

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

◆ message()

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

◆ no_binding_support()

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

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

◆ unexpected()

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

◆ 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

◆ xml_could_not_parse()

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

◆ xmp_key_not_found()

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

◆ xmp_not_found()

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

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