Skip to content

Instantly share code, notes, and snippets.

@abolibibelot
Last active December 30, 2015 00:28
Show Gist options
  • Save abolibibelot/7749397 to your computer and use it in GitHub Desktop.
Save abolibibelot/7749397 to your computer and use it in GitHub Desktop.
try unsafe(PVS) of
Res -> Res
catch
A:B -> lager:error("Problem:~p stacktrace:~p",[[A,B], erlang:get_stacktrace()]),
case {A,B} of
{exit,_} -> exit(B);
{error,_} -> error(B);
{exception,_} -> throw(B)
end
end.
@kpy3
Copy link

kpy3 commented Dec 3, 2013

This one is better:

try unsafe(PVS) of
Res -> Res
catch
A:B ->
St = erlang:get_stacktrace(),
lager:error("Problem:~p stacktrace:~p",[[A,B], St]),
erlang:raise(A,B,St)
end.

@abolibibelot
Copy link
Author

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment