Flox Package Database 1
CRUD Operations on Nix Package Metadata
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
flox::FloxException Class Reference

#include <exceptions.hh>

Inheritance diagram for flox::FloxException:
flox::NixEvalException

Public Member Functions

 FloxException (std::string_view contextMsg)
 Create a generic exception with a custom message.
 
 FloxException (std::string_view contextMsg, std::string_view caughtMsg)
 Create a generic exception with a custom message and information from a child error.
 
 FloxException (std::string_view categoryMsg, std::optional< std::string > contextMsg, std::optional< std::string > caughtMsg)
 Directly initialize a FloxException with a custom category message, (optional) context, and (optional) information from a child error.
 
virtual error_category getErrorCode () const noexcept
 
std::optional< std::string > getContextMessage () const noexcept
 
std::optional< std::string > getCaughtMessage () const noexcept
 
virtual std::string_view getCategoryMessage () const noexcept
 
const char * what () const noexcept override
 Produces an explanatory string about an exception.
 

Private Attributes

std::optional< std::string > contextMsg
 
std::optional< std::string > caughtMsg
 
std::string whatMsg
 

Detailed Description

Typed exception wrapper used for misc errors.

Constructor & Destructor Documentation

◆ FloxException() [1/3]

flox::FloxException::FloxException ( std::string_view  contextMsg)
inlineexplicit

Create a generic exception with a custom message.

This constructor is NOT suitable for use by child classes.

◆ FloxException() [2/3]

flox::FloxException::FloxException ( std::string_view  contextMsg,
std::string_view  caughtMsg 
)
inlineexplicit

Create a generic exception with a custom message and information from a child error.

This constructor is NOT suitable for use by child classes.

◆ FloxException() [3/3]

flox::FloxException::FloxException ( std::string_view  categoryMsg,
std::optional< std::string >  contextMsg,
std::optional< std::string >  caughtMsg 
)
inlineexplicit

Directly initialize a FloxException with a custom category message, (optional) context, and (optional) information from a child error.

This form is recommended for use by child classes which extend flox::FloxException.

See also
FLOX_DEFINE_EXCEPTION

Member Data Documentation

◆ caughtMsg

std::optional<std::string> flox::FloxException::caughtMsg
private

If some other exception was caught before throwing this one, caughtMsg contains what() of that exception.

◆ contextMsg

std::optional<std::string> flox::FloxException::contextMsg
private

Additional context added when the error is thrown.

◆ whatMsg

std::string flox::FloxException::whatMsg
private

The final what() message.


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