Erlang question on Artima blog
Sun Mar 14 19:58:04 CET 2004
On Sun, 14 Mar 2004 13:48:33 -0500, Vance Shipley <vances@REDACTED>
> The real trick is to decide when to accept errors and when
> not to. You expect file:open/2 to always work and if it
> doesn't you crash. That one's easy. When you are parsing
> user input, like in a shell, you probably want to handle
> unexpected data without crashing. What about external
> data arriving in a protocol? If it doesn't obey the
> protocol should you crash or should you treat it as the
> user input case? What about databases; if they don't
> contain the data you expect should you crash? Designing
> an error handling strategy can be complicated.
Agreed. That's what I meant by:
On Sun, 14 Mar 2004 09:31:16 +0100, Ulf Wiger <ulf.wiger@REDACTED> wrote:
> You need to sit down and really think about how and
> where you want to handle errors in your code.
But I've found that in most of my programs, it's sufficient to
handle errors in a few places, and let the rest of the functions
exit as soon as anything unexpected happens.
More information about the erlang-questions