ae.utils.exception

Exception formatting

Members

Aliases

CaughtException
alias CaughtException = NoException

Allows toggling catch blocks with -debug=NO_CATCH. To use, catch CaughtException instead of Exception in catch blocks.

CaughtException
alias CaughtException = Exception
Undocumented in source.
assertEqual
alias assertEqual = assertOp!"=="
Undocumented in source.

Classes

NoException
class NoException

This exception can never be thrown. Useful for a temporary or aliased catch block exception type.

Functions

exceptionContext
string exceptionContext(string messageExpr, string name)

Returns string mixin for adding a chained exception

formatException
string formatException(Throwable e)

Stringify an exception chain.

getStackTrace
string[] getStackTrace(string until, string since)

Extracts the stack trace from an exception's toString, as an array of lines.

Mixin templates

DeclareException
mixintemplate DeclareException(string NAME, BASE = Exception)

Mixin to declare a new exception type with the given name. Automatically generates common constructors.

Templates

assertOp
template assertOp(string op)

Test helper. Asserts that a op b, and includes the values in the error message.

Meta

License

This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.

Authors

Vladimir Panteleev <ae@cy.md>