<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 8 November 2016 at 12:50, Mike Parker via Digitalmars-d <span dir="ltr"><<a href="mailto:digitalmars-d@puremagic.com" target="_blank">digitalmars-d@puremagic.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Tuesday, 8 November 2016 at 01:50:26 UTC, Walter Bright wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On 11/7/2016 4:12 PM, Robert burner Schadek wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On Monday, 7 November 2016 at 23:37:18 UTC, Walter Bright wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
void callback() nothrow<br>
{<br>
    scope (failure)<br>
    {<br>
        ...log error or abort...<br>
    }<br>
    ...lots of code...<br>
}<br>
</blockquote>
<br>
Who to get the Exception thrown in the scope(failure)<br>
</blockquote>
<br>
You don't. The exception is also rethrown, so it isn't an exact replacement. (The 'nothrow' is a mistake on my part.)<br>
</blockquote>
<br></div></div>
In this specific case, a function used as a callback for a C API, it really ought to be nothrow because of the inconsistent behavior with propagating exceptions across language boundaries. scope(exit) just isn't useful here.<br></blockquote><div><br></div><div>It's not strictly useful for interaction with C, it would be equally useful in the situation where a nothrow function returns an error code or something. The tail-catch block could do the translation and return the error, and it would be in a nice place separate from the main function body.</div></div></div></div>