So a conversation arose for me and some friends around a passage in this page of Elixir documentation.
In Elixir, a value can be thrown and later be caught. throw and catch are reserved for situations where it is not possible to retrieve a value unless by using throw and catch.
Those situations are quite uncommon in practice except when interfacing with libraries that do not provide a proper API.
Which situations would require using try/throw/catch
vs. try/rescue
? Is this for interfacing with some existing Erlang libraries? The sample on the page shows Elixir code which is what I find a bit confusing.
What would be the "proper API" that I should be looking for? I mean would this be a protocol?