DryChem 1.0.0
A generic, compile-time C++ toolbox with no dependencies for the modern computational chemistry project.
Loading...
Searching...
No Matches
CppUtils::Errors Namespace Reference

Classes

struct  ErrorMessage
 
class  FatalException
 
struct  is_fatal
 
struct  is_fatal< ErrorSeverity::Fatal >
 

Enumerations

enum class  ErrorSeverity { Warning , Fatal }
 

Functions

template<ErrorSeverity Severity = ErrorSeverity::Warning>
void printErrorMessage (const ErrorMessage &error)
 

Variables

template<ErrorSeverity Severity>
constexpr bool is_fatal_v = is_fatal<Severity>::value
 Convenience variable template for ease-of-use.
 
auto printFatalErrorMessage = [](const ErrorMessage& error) { printErrorMessage<ErrorSeverity::Fatal>(error); }
 A convenience function for printing an error message when said error is fatal.
 

Enumeration Type Documentation

◆ ErrorSeverity

A simple scoped enumeration for use in defining the severity of the error in a cleaner, more verbose way than simple boolean flags would allow.

Enumerator
Warning 

Describes the severity of an error that only requires a warning.

Fatal 

Describes the severity of a fatal, non-recoverable error.

Function Documentation

◆ printErrorMessage()

template<ErrorSeverity Severity = ErrorSeverity::Warning>
void CppUtils::Errors::printErrorMessage ( const ErrorMessage & error)
inline

A simple function to format and print an error message according to 1) the information provided, and 2) the severity of the given error.

Template Parameters
Severity- The severity of the error in question (defaults to a warning message)
Parameters
error- The error message and other information about the location of the error

References CppUtils::Errors::ErrorMessage::fileName, is_fatal_v, CppUtils::Errors::ErrorMessage::lineNumber, CppUtils::Errors::ErrorMessage::message, and CppUtils::Errors::ErrorMessage::programName.

Referenced by CppUtils::Strings::lexical_cast().

Variable Documentation

◆ is_fatal_v

template<ErrorSeverity Severity>
bool CppUtils::Errors::is_fatal_v = is_fatal<Severity>::value
constexpr

Referenced by printErrorMessage().

◆ printFatalErrorMessage

auto CppUtils::Errors::printFatalErrorMessage = [](const ErrorMessage& error) { printErrorMessage<ErrorSeverity::Fatal>(error); }
inline