[#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&period;

== Synopsis

Declared in `&lt;bslstl&lowbar;stdexceptutil&period;h&gt;`

[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&period; One such static function pointer exists for each exception type supported by this component&period; Functions called to throw exceptions examine their respective pointer, and if it&apos;s non&hyphen;null, call it and then throw after it returns&period; Note that it is recommended that the hook function log a greppable statement such as &quot;About to throw &lt;exceptionName&gt;&quot;&period;
|===


== Static Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bslstl/StdExceptUtil/logCheapStackTrace.adoc[`logCheapStackTrace`] 
| Log &quot;About to throw &quot;, then the specified `exceptionName`, then the specified `message`, then log a cheap stack trace with warning severity&period; This function is intended as a candidate for setting to the pre&hyphen;throw hooks&period; Note that a far slower alternative to this, which logs a full, multi&hyphen;line stack trace with resolved symbols and, on many platforms, line numbers and source file names, is `balst&colon;&colon;StackTracePrintUtil&colon;&colon;logExceptionStackTrace`&period;
| xref:BloombergLP/bslstl/StdExceptUtil/setDomainErrorHook.adoc[`setDomainErrorHook`] 
| Set the pre&hyphen;throw hook for `std&colon;&colon;domain&lowbar;error` to the specified `hook`&period;
| xref:BloombergLP/bslstl/StdExceptUtil/setInvalidArgumentHook.adoc[`setInvalidArgumentHook`] 
| Set the pre&hyphen;throw hook for `std&colon;&colon;invalid&lowbar;argument` to the specified `hook`&period;
| xref:BloombergLP/bslstl/StdExceptUtil/setLengthErrorHook.adoc[`setLengthErrorHook`] 
| Set the pre&hyphen;throw hook for `std&colon;&colon;length&lowbar;error` to the specified `hook`&period;
| xref:BloombergLP/bslstl/StdExceptUtil/setLogicErrorHook.adoc[`setLogicErrorHook`] 
| Set the pre&hyphen;throw hook for `std&colon;&colon;logic&lowbar;error` to the specified `hook`&period;
| xref:BloombergLP/bslstl/StdExceptUtil/setOutOfRangeHook.adoc[`setOutOfRangeHook`] 
| Set the pre&hyphen;throw hook for `std&colon;&colon;out&lowbar;of&lowbar;range` to the specified `hook`&period;
| xref:BloombergLP/bslstl/StdExceptUtil/setOverflowErrorHook.adoc[`setOverflowErrorHook`] 
| Set the pre&hyphen;throw hook for `std&colon;&colon;overflow&lowbar;error` to the specified `hook`&period;
| xref:BloombergLP/bslstl/StdExceptUtil/setRangeErrorHook.adoc[`setRangeErrorHook`] 
| Set the pre&hyphen;throw hook for `std&colon;&colon;range&lowbar;error` to the specified `hook`&period;
| xref:BloombergLP/bslstl/StdExceptUtil/setRuntimeErrorHook.adoc[`setRuntimeErrorHook`] 
| Set the pre&hyphen;throw hook for `std&colon;&colon;runtime&lowbar;error` to the specified `hook`&period;
| xref:BloombergLP/bslstl/StdExceptUtil/setUnderflowErrorHook.adoc[`setUnderflowErrorHook`] 
| Set the pre throw hook for the specified exception type to the specified `hook`&period; If `hook` is passed 0, or if the settor was never called, that means that no pre&hyphen;throw function will be called&period;
| xref:BloombergLP/bslstl/StdExceptUtil/throwDomainError.adoc[`throwDomainError`]  [.small]#[noreturn]#
| Throw a `std&colon;&colon;domain&lowbar;error` exception supplying the specified `message` as the sole argument to its constructor&period;
| xref:BloombergLP/bslstl/StdExceptUtil/throwInvalidArgument.adoc[`throwInvalidArgument`]  [.small]#[noreturn]#
| Throw a `std&colon;&colon;invalid&lowbar;argument` exception supplying the specified `message` as the sole argument to its constructor&period;
| xref:BloombergLP/bslstl/StdExceptUtil/throwLengthError.adoc[`throwLengthError`]  [.small]#[noreturn]#
| Throw a `std&colon;&colon;length&lowbar;error` exception supplying the specified `message` as the sole argument to its constructor&period;
| xref:BloombergLP/bslstl/StdExceptUtil/throwLogicError.adoc[`throwLogicError`]  [.small]#[noreturn]#
| Throw a `std&colon;&colon;logic&lowbar;error` exception supplying the specified `message` as the sole argument to its constructor&period;
| xref:BloombergLP/bslstl/StdExceptUtil/throwOutOfRange.adoc[`throwOutOfRange`]  [.small]#[noreturn]#
| Throw a `std&colon;&colon;out&lowbar;of&lowbar;range` exception supplying the specified `message` as the sole argument to its constructor&period;
| xref:BloombergLP/bslstl/StdExceptUtil/throwOverflowError.adoc[`throwOverflowError`]  [.small]#[noreturn]#
| Throw a `std&colon;&colon;overflow&lowbar;error` exception supplying the specified `message` as the sole argument to its constructor&period;
| xref:BloombergLP/bslstl/StdExceptUtil/throwRangeError.adoc[`throwRangeError`]  [.small]#[noreturn]#
| Throw a `std&colon;&colon;range&lowbar;error` exception supplying the specified `message` as the sole argument to its constructor&period;
| xref:BloombergLP/bslstl/StdExceptUtil/throwRuntimeError.adoc[`throwRuntimeError`]  [.small]#[noreturn]#
| Throw a `std&colon;&colon;runtime&lowbar;error` exception supplying the specified `message` as the sole argument to its constructor&period;
| xref:BloombergLP/bslstl/StdExceptUtil/throwUnderflowError.adoc[`throwUnderflowError`]  [.small]#[noreturn]#
| Throw a `std&colon;&colon;underflow&lowbar;error` exception supplying the specified `message` as the sole argument to its constructor&period;
|===



[.small]#Created with https://www.mrdocs.com[MrDocs]#
