DocWire SDK
DocWire SDK: Deterministic, auditable, and secure data processing in C++20. On-premise by default. No compromises on computational speed.
Loading...
Searching...
No Matches
docwire::errors Namespace Reference

Provides features for reporting and handling errors with context data using nested exceptions. More...

Classes

struct  base
 Base class for all exceptions in the SDK. More...
struct  file_encrypted
 File is encrypted error tag. More...
struct  impl
 Implementation of the error class for a variadic number of context items. More...
class  nested
 A template class that simplifies the creation of nested exceptions. More...
struct  network_failure
 Network failure error tag. More...
struct  program_corrupted
 Program corrupted error tag. More...
struct  program_logic
 Program logic failure error tag. More...
struct  uninterpretable_data
 Uninterpretable data error tag. More...

Functions

template<typename T>
bool contains_type (const std::exception &e)
 Checks if the given nested exceptions chain contains a specific type of context.
void panic (std::exception_ptr eptr)
 Terminates the program with a panic message in debug builds.
std::string diagnostic_message (const std::exception &e)
 Generates a diagnostic message for the given nested exceptions chain.
std::string diagnostic_message (std::exception_ptr eptr)
 Generates a diagnostic message for the given nested exceptions chain.
template<typename... Context>
auto make_error_from_tuple (const source_location &location, std::tuple< Context... > &&context_tuple)
 Creates an error object from a tuple of context information.
template<typename... Context>
auto make_error_ptr_from_tuple (const source_location &location, std::tuple< Context... > &&context_tuple)
 Creates an exception_ptr containing an error object from a tuple of context information.
template<typename Inner, typename Outer>
auto make_nested (Inner &&inner, Outer &&outer)
 Creates a nested exception from an inner exception and an outer exception.
template<typename Inner, typename Outer, typename... Rest>
auto make_nested (Inner &&inner, Outer &&outer, Rest &&... rest)
 Creates a nested exception from inner exception and multiple outer exceptions.
template<typename Inner, typename Outer, typename... Rest>
std::exception_ptr make_nested_ptr (Inner &&inner, Outer &&outer, Rest &&... rest)
 Creates a pointer to a nested exception from an inner exception and an outer exception.

Detailed Description

Provides features for reporting and handling errors with context data using nested exceptions.

See also
handling errors and warnings example

Function Documentation

◆ contains_type()

template<typename T>
bool docwire::errors::contains_type ( const std::exception & e)

Checks if the given nested exceptions chain contains a specific type of context.

Examples
handling_errors_and_warnings.cpp.

Definition at line 25 of file contains_type.h.

◆ diagnostic_message() [1/2]

◆ diagnostic_message() [2/2]

std::string docwire::errors::diagnostic_message ( std::exception_ptr eptr)
inline

Generates a diagnostic message for the given nested exceptions chain.

Definition at line 77 of file diagnostic_message.h.

◆ make_error_from_tuple()

template<typename... Context>
auto docwire::errors::make_error_from_tuple ( const source_location & location,
std::tuple< Context... > && context_tuple )

Creates an error object from a tuple of context information.

Parameters
locationThe source location where the error occurred.
context_tupleA tuple containing context data.
Returns
The constructed error object.

Definition at line 30 of file make_error.h.

◆ make_error_ptr_from_tuple()

template<typename... Context>
auto docwire::errors::make_error_ptr_from_tuple ( const source_location & location,
std::tuple< Context... > && context_tuple )

Creates an exception_ptr containing an error object from a tuple of context information.

Parameters
locationThe source location where the error occurred.
context_tupleA tuple containing context data.
Returns
An exception_ptr to the constructed error.

Definition at line 44 of file make_error.h.

◆ make_nested() [1/2]

template<typename Inner, typename Outer>
auto docwire::errors::make_nested ( Inner && inner,
Outer && outer )

Creates a nested exception from an inner exception and an outer exception.

This function creates a nested exception by throwing the inner exception and catching it, then using the outer exception to create a nested exception.

Template Parameters
InnerThe type of the inner exception.
OuterThe type of the outer exception.
Parameters
innerThe inner exception to be nested. Can be exception object or std::exception_ptr.
outerThe outer exception to wrap the inner exception.
Returns
A nested exception object containing the inner and outer exceptions.
See also
nested
std::nested_exception
std::exception_ptr

Definition at line 84 of file nested_exception.h.

◆ make_nested() [2/2]

template<typename Inner, typename Outer, typename... Rest>
auto docwire::errors::make_nested ( Inner && inner,
Outer && outer,
Rest &&... rest )

Creates a nested exception from inner exception and multiple outer exceptions.

This function creates a nested exception by recursively calling make_nested with the inner exception and the outer exceptions.

Template Parameters
InnerThe type of the inner exception.
OuterThe type of the outer exception.
RestThe types of additional outer exceptions (additional layers of nesting).
Parameters
innerThe inner exception to be nested. Can be exception object or std::exception_ptr.
outerThe outer exception to wrap the inner exception.
restAdditional outer exceptions to add additional layers of nesting.
Returns
A nested exception object containing whole layers of nested exceptions.
See also
nested
std::nested_exception
std::exception_ptr

Definition at line 119 of file nested_exception.h.

◆ make_nested_ptr()

template<typename Inner, typename Outer, typename... Rest>
std::exception_ptr docwire::errors::make_nested_ptr ( Inner && inner,
Outer && outer,
Rest &&... rest )

Creates a pointer to a nested exception from an inner exception and an outer exception.

This function creates a pointer to a nested exception by recursively calling make_nested with the inner exception and the outer exceptions and then converting the result to a std::exception_ptr.

Template Parameters
InnerThe type of the inner exception.
OuterThe type of the outer exception.
RestThe types of additional outer exceptions (additional layers of nesting).
Parameters
innerThe inner exception to be nested. Can be exception object or std::exception_ptr.
outerThe outer exception to wrap the inner exception.
restAdditional outer exceptions to add additional layers of nesting.
Returns
A pointer to a nested exception object containing whole layers of nested exceptions.
See also
nested
std::nested_exception
std::exception_ptr

Definition at line 145 of file nested_exception.h.

◆ panic()

void docwire::errors::panic ( std::exception_ptr eptr)
inline

Terminates the program with a panic message in debug builds.

Definition at line 32 of file debug_assert.h.