[erlang-questions] more try/catch confusion

Steve Vinoski vinoski@REDACTED
Wed Apr 7 00:21:38 CEST 2010


On Tue, Apr 6, 2010 at 6:07 PM, Brian Acton <acton@REDACTED> wrote:
> Hi guys,
>
> I recently went down the road of doing some xml parsing. Using the xmerl
> libraries, I tried writing the following construct:
>
> 1> try xmerl_scan:file("broken.xml") catch H -> H end.

You're missing the exception type part of your catch. If you leave it
out, it defaults to throw, but this isn't a throw, it's an exit. Use
this instead:

try xmerl_scan:file("broken.xml") catch exit:H -> H end.

or

try xmerl_scan:file("broken.xml") catch _:H -> H end.

--steve


More information about the erlang-questions mailing list