[erlang-questions] feedback please
Thu Sep 24 09:29:52 CEST 2015
On 09/24/2015 12:16 AM, Theepan wrote:
> For off schema data it should crash.
> If something has a chance of happening, although it
> is expected, use try-catch.
This isn't a universal rule.
I have a section in one of my programs where one of a *very* wide array
of errors can come back from an operation on external system. For the
*few* errors that I know how to handle and *expect* to happen, I have
matching case clauses. For the *rest* of the errors that I either don't
know how to handle, are aren't really expecting, I have a catch-all
clause with a WARN print that spews details to the system log. If I hit
an unexpected error, I figure out if I need to and how to handle it,
then add a clause in the case statement.
In my case, for this part of the software, it's better to keep running
than it is to crash because I hit one of the billion errors that I never
expected to have to handle.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 819 bytes
Desc: OpenPGP digital signature
More information about the erlang-questions