ON_THROW#
-
ON_THROW(...)#
Statement-shaped sink: ON_THROW(policy-expression) { body }; The policy expression is evaluated with
sumpvisible, so ON_THROW(notify & retry * 3 | subst(-1)) { return flaky(); }; needs no qualification.All arguments forward to sump::sink, so a source_location may follow the policy: ON_THROW(notify, loc) { body };. Expands to sump::sink(…) ->* a reference-capturing lambda; the call-site location is the macro’s. The macro ends at
[&](): supply the body type by composition when needed, as in ON_THROW(retry | subst(-1)) -> int { throw failure(); };.The block-scope using-declarations pin
abortandterminateto the policies. Without them, using the macro at global scope with the C library in scope would be ambiguous: the using-directive parks the policy names at the nearest namespace enclosing both it andsump, which in user code is the global namespace, right next to the C library’sabort.