throwChained

Throws a new exception E chained together with an existing exception.

void
throwChained
(
E : Throwable = Exception
)
(
lazy Throwable e
,,
istring file = __FILE__
,
int line = __LINE__
)

Parameters

E

type of exception to throw

e Throwable

existing exception to chain with new exception

msg istring

message to pass to exception constructor

file istring

file from which this exception was thrown

line int

line from which this exception was thrown

Examples

auto next_e = new Exception("1");

try
{
    throwChained!(Exception)(next_e, "2");
    assert (false);
}
catch (Exception e)
{
    assert (e.next is next_e);
    assert (e.message() == "2");
    assert (e.next.msg == "1");
}

Meta