Quite frequently, I resort to returning tagged tuples as well because I want to print nice error messages to logs for the Support team to look at. They can't understand crash reports and I don't blame them for it.<br><br>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.
<br><br>foo() -><br> try<br> do_something()<br> catch<br> exit:{{badmatch, {error, enoent}}, opening_file1_failed} -><br> ok;<br> exit:{{badmatch, {error, enofile}}, opening_file2_failed} ->
<br> ok;<br> exit:Reason -> <br> {'EXIT', Reason}<br><span style="font-family: monospace;"></span> end.<br><br>do_something() -><br> {ok, Iod1}:{exception, opening_file1_failed} = file:open("
file1.txt", [read, raw]),<br> {ok, Iod2}:{exception, opening_file2_failed} = file:open("file2.txt", [write, raw]),<br>
bar(Iod1, Iod2).<br><br> <br>cheers<br>Chandru<br><br>