getExceptionMsg

Return the exception message of an exception. If no exception was thrown, then a new exception is thrown to notify the user of the missing exception.

string
getExceptionMsg
(
E
)
(
lazy E expr
,
string file = __FILE__
,
size_t line = __LINE__
)

Examples

assert(getExceptionMsg({ throw new Exception("my message"); }()) == "my message");
assert(getExceptionMsg({ }()).getExceptionMsg == "Error: No exception was thrown.");

Meta