Throw

Hook implementation that throws exceptions instead of default assert behavior.

Members

Static functions

onAccessEmptyError
void onAccessEmptyError()

Handler for case when empty error is accessed.

onAccessEmptyValue
void onAccessEmptyValue(E err)

Handler for case when empty value is accessed.

Static variables

enableDefaultConstructor
bool enableDefaultConstructor;

Default constructor for Expected is disabled. Same with the opAssign, so Expected can be only constructed once and not modified afterwards.

Examples

static assert(!isDefaultConstructorEnabled!Throw);
static assert(hasOnAccessEmptyValue!(Throw, string));
static assert(hasOnAccessEmptyValue!(Throw, int));
static assert(hasOnAccessEmptyError!Throw);

assertThrown!(Unexpected!string)(ok!(string, Throw)(42).error);
assertThrown!(Unexpected!string)(err!(int, Throw)("foo").value);
assertThrown!(Unexpected!int)(err!(bool, Throw)(-1).value);

Meta