xentara-utils v2.0.4
The Xentara Utility Library
Loading...
Searching...
No Matches
xentara::utils::eh Namespace Reference

Exception and error handling. More...

Namespaces

namespace  deprecated
 

Classes

class  bad_expected_access
 Implementation of C++23 std::bad_expected_access](https://en.cppreference.com/w/cpp/utility/expected/bad_expected_access) More...
 
class  ExceptionGuard
 A class that detects whether the stack is currently being wound up. More...
 
class  expected
 Implementation of C++23 std::expected More...
 
struct  unexpect_t
 Implementation of C++23 std::unexpect_t More...
 
class  unexpected
 Implementation of C++23 std::unexpected More...
 

Functions

auto currentErrorCode () noexcept -> std::error_code
 Returns an error code for the current exception.
 

Detailed Description

Exception and error handling.

This namespace contains facilities used for error and exception handling.

Function Documentation

◆ currentErrorCode()

auto xentara::utils::eh::currentErrorCode ( ) -> std::error_code
noexcept

Returns an error code for the current exception.

This function returns an error code that describes the current exception, as retuned by std::current_exception(). If the current exception is derived from std::system_error, the corresponding error is returned. Otherwise, a custom error code is returned.

A custom error code is also returned for system errors containing an error code with error number 0.

If there is no current exception, std::error_code() is returned.

Include file
#include <xentara/utils/eh/currentErrorCode.hpp>
Returns
An error code describing the current exception, or std::error_code() for none.
See also
std::current_exception