The OpenD Programming Language

enforce

version(D_Exceptions)
ref @trusted
enforce
(
string fmt
string file = __FILE__
int line = __LINE__
Expr
)
(
scope auto return ref Expr arg
)

Examples

import mir.exception;
try enforce!"Msg"(false);
catch(Exception e) assert(e.msg == "Msg");

Meta