xentara-utils v1.2
Xentara utilities library
No Matches
xentara::utils::eh Namespace Reference

Exception and error handling. More...


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...
class  Failable
 A value that may be replaced by an error code. More...
struct  unexpect_t
 Implementation of C++23 std::unexpect_t More...
class  unexpected
 Implementation of C++23 std::unexpected More...


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

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.

An error code describing the current exception, or std::error_code() for none.
See also