xentara-utils v1.0
Xentara utilities library
xentara::utils::eh Namespace Reference

Exception and error handling. More...


class  ExceptionGuard
 A class that detects whether the stack is currently being wound up. More...
class  Failable
 A value that may be replaced by an error code. More...


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

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 excpetion, std::error_code() is returned.

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