same as enforceRet
extern(C) static int func(int a, int b) { .errno = EMFILE; test!("==")(a, 41); test!("==")(b, 43); return -1; } try { (new ErrnoException).enforceRetCode!(func)().call(41, 43); test(false); } catch (ErrnoException e) { test!("==")(e.message(), "func: Too many open files"[]); test!("==")(e.failedFunctionName(), "func"[]); test!("==")(e.line, __LINE__ - 7); }
Calls enforceRet interpreting return value as error code
Wraps enforceRet with a lambda that verifies that return value is zero (success code). Any non-zero return value of Func is interpreted as a failure.