[#BloombergLP-bslstl-StdExceptUtil] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslstl.adoc[bslstl]::StdExceptUtil :relfileprefix: ../../ :mrdocs: This `struct` provides a namespace for `static` utility functions that throw standard library exceptions. == Synopsis Declared in `<bslstl_stdexceptutil.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- struct StdExceptUtil; ---- == Type Aliases [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bslstl/StdExceptUtil/PreThrowHook.adoc[`PreThrowHook`] | This is the type of function pointer that can be set. One such static function pointer exists for each exception type supported by this component. Functions called to throw exceptions examine their respective pointer, and if it's non‐null, call it and then throw after it returns. Note that it is recommended that the hook function log a greppable statement such as "About to throw <exceptionName>". |=== == Static Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bslstl/StdExceptUtil/logCheapStackTrace.adoc[`logCheapStackTrace`] | Log "About to throw ", then the specified `exceptionName`, then the specified `message`, then log a cheap stack trace with warning severity. This function is intended as a candidate for setting to the pre‐throw hooks. Note that a far slower alternative to this, which logs a full, multi‐line stack trace with resolved symbols and, on many platforms, line numbers and source file names, is `balst::StackTracePrintUtil::logExceptionStackTrace`. | xref:BloombergLP/bslstl/StdExceptUtil/setDomainErrorHook.adoc[`setDomainErrorHook`] | Set the pre‐throw hook for `std::domain_error` to the specified `hook`. | xref:BloombergLP/bslstl/StdExceptUtil/setInvalidArgumentHook.adoc[`setInvalidArgumentHook`] | Set the pre‐throw hook for `std::invalid_argument` to the specified `hook`. | xref:BloombergLP/bslstl/StdExceptUtil/setLengthErrorHook.adoc[`setLengthErrorHook`] | Set the pre‐throw hook for `std::length_error` to the specified `hook`. | xref:BloombergLP/bslstl/StdExceptUtil/setLogicErrorHook.adoc[`setLogicErrorHook`] | Set the pre‐throw hook for `std::logic_error` to the specified `hook`. | xref:BloombergLP/bslstl/StdExceptUtil/setOutOfRangeHook.adoc[`setOutOfRangeHook`] | Set the pre‐throw hook for `std::out_of_range` to the specified `hook`. | xref:BloombergLP/bslstl/StdExceptUtil/setOverflowErrorHook.adoc[`setOverflowErrorHook`] | Set the pre‐throw hook for `std::overflow_error` to the specified `hook`. | xref:BloombergLP/bslstl/StdExceptUtil/setRangeErrorHook.adoc[`setRangeErrorHook`] | Set the pre‐throw hook for `std::range_error` to the specified `hook`. | xref:BloombergLP/bslstl/StdExceptUtil/setRuntimeErrorHook.adoc[`setRuntimeErrorHook`] | Set the pre‐throw hook for `std::runtime_error` to the specified `hook`. | xref:BloombergLP/bslstl/StdExceptUtil/setUnderflowErrorHook.adoc[`setUnderflowErrorHook`] | Set the pre throw hook for the specified exception type to the specified `hook`. If `hook` is passed 0, or if the settor was never called, that means that no pre‐throw function will be called. | xref:BloombergLP/bslstl/StdExceptUtil/throwDomainError.adoc[`throwDomainError`] [.small]#[noreturn]# | Throw a `std::domain_error` exception supplying the specified `message` as the sole argument to its constructor. | xref:BloombergLP/bslstl/StdExceptUtil/throwInvalidArgument.adoc[`throwInvalidArgument`] [.small]#[noreturn]# | Throw a `std::invalid_argument` exception supplying the specified `message` as the sole argument to its constructor. | xref:BloombergLP/bslstl/StdExceptUtil/throwLengthError.adoc[`throwLengthError`] [.small]#[noreturn]# | Throw a `std::length_error` exception supplying the specified `message` as the sole argument to its constructor. | xref:BloombergLP/bslstl/StdExceptUtil/throwLogicError.adoc[`throwLogicError`] [.small]#[noreturn]# | Throw a `std::logic_error` exception supplying the specified `message` as the sole argument to its constructor. | xref:BloombergLP/bslstl/StdExceptUtil/throwOutOfRange.adoc[`throwOutOfRange`] [.small]#[noreturn]# | Throw a `std::out_of_range` exception supplying the specified `message` as the sole argument to its constructor. | xref:BloombergLP/bslstl/StdExceptUtil/throwOverflowError.adoc[`throwOverflowError`] [.small]#[noreturn]# | Throw a `std::overflow_error` exception supplying the specified `message` as the sole argument to its constructor. | xref:BloombergLP/bslstl/StdExceptUtil/throwRangeError.adoc[`throwRangeError`] [.small]#[noreturn]# | Throw a `std::range_error` exception supplying the specified `message` as the sole argument to its constructor. | xref:BloombergLP/bslstl/StdExceptUtil/throwRuntimeError.adoc[`throwRuntimeError`] [.small]#[noreturn]# | Throw a `std::runtime_error` exception supplying the specified `message` as the sole argument to its constructor. | xref:BloombergLP/bslstl/StdExceptUtil/throwUnderflowError.adoc[`throwUnderflowError`] [.small]#[noreturn]# | Throw a `std::underflow_error` exception supplying the specified `message` as the sole argument to its constructor. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#