[erlang-questions] Exceptions vs Tagged Values

Mats Cronqvist <>
Wed Nov 15 12:18:59 CET 2006


Chandru wrote:
> What would be nice though is for the programmer to be able to specify what
> additional information should be included in an exception should a match
> expression fail. At the moment, we get a badmatch exception which is not
> very useful when you want to report exactly what went wrong. Here is some
> pseudo code to illustrate my point.

   isn't this just because file:open/2 (and many other lib functions) has such 
crappy error reporting?  if it returned, say,
{error,{error_opening,FileName,no_permission}}
   you could just toss the {badmatch,{error,}} cruft and be happy.

   mats

p.s. it throwing {error_opening,FileName,no_permission} would of course be even 
better :>



More information about the erlang-questions mailing list