expression that returns false upon failure that is expected to set global errno
extra error message to append after main error description, can be empty
extern function name that is expected to set errno
file where the expr is evaluated
line where the expr is evaluated
this if 'expr' is false
try { (new ErrnoException).enforce( { .errno = EMFILE; return false; } (), "extra", "FUNCTION" ); test(false); } catch (ErrnoException e) { test!("==")(e.message(), "FUNCTION: Too many open files (extra)"[]); test!("==")(e.errorNumber(), EMFILE); }
Tries to evaluate expr. If it fails, checks the global errno and uses matching message as base for exception message, as well as throws the exception.