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

Per Hedeland <>
Sun May 15 21:52:28 CEST 2016


Garrett Smith <> wrote:
>
>I've made a mistake here and I need to apologize for it. Per, I'm
>simply in no position to take such a tone with you. You indeed are no
>rookie, and I over stepped my bounds here in a terribly embarrassing
>way.
>
>I'll turn my attention to cleaning up my own code and save the
>lectures for myself!

Don't be silly - I can take any tone, and I think there was lots of good
stuff in your reply, just that it didn't really help *me*. If you have
any comments om my actual question, I would be very interested.

I should say though that I've pretty much come to the conclusion that
the documentation for erlang:raise/3 should be amended to say something
along the lines of "this function is useful if you want to re-raise a
caught exception after doing some cleanup, but for any *other* usage,
take heed of the following warning: ..." The problem with the function
is basically just that it *can* be used in "other" ways, such as
synthesizing an exception that didn't actually occur. And it's hard (at
least for me) to see how a function that *only* allowed for re-raising a
caught exception could be defined, given the existing try ... catch
infrastructure.

--Per

PS On grepping the OTP code, among the massive amount of erlang:raise/3
usage, I found at least one that perfectly matches my case: file_sorter.


More information about the erlang-questions mailing list