<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Sun, May 15, 2016 at 9:17 PM, Per Hedeland <span dir="ltr"><<a href="mailto:per@hedeland.org" target="_blank">per@hedeland.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">So this ends up *always* sending the "done" after invoking the fun, but<br>
that doesn't match the protocol - if you look at the original function,<br>
there is one case where "continue" should be sent *instead*.</blockquote><div><br></div><div>yes, I noticed that, which is why it's not a perfect fit :) What you want to have is someway to know in the after clause if an exception was thrown or not.... I'm not sure that is possible. I had an idea of doing something fancy with inspecting the stacktrace in the after clause, but it seems to be indistinguishable from an error happening and being caught below the try. </div><div><br></div><div>Sometimes erlang:raise is the right tool for the job and this may be one of them. Just make sure not to crash in the catch before the re-throw :)</div></div></div></div>