[erlang-questions] erlang:raise/3 considered harmful?

Lukas Larsson <>
Sun May 15 21:39:49 CEST 2016


On Sun, May 15, 2016 at 9:17 PM, Per Hedeland <> wrote:

> So this ends up *always* sending the "done" after invoking the fun, but
> that doesn't match the protocol - if you look at the original function,
> there is one case where "continue" should be sent *instead*.


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.

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 :)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20160515/52ad779f/attachment.html>


More information about the erlang-questions mailing list