[erlang-questions] Unexpected try/catch behaviour

Jeroen Koops <>
Tue Feb 23 12:39:37 CET 2010


>From the Erlang Reference Manual:

>
> "try Exprs of
>    Pattern1 [when GuardSeq1] ->
>        Body1;
>    ...;
>    PatternN [when GuardSeqN] ->
>        BodyN
> catch
>    [Class1:]ExceptionPattern1 [when ExceptionGuardSeq1] ->
>        ExceptionBody1;
>    ...;
>    [ClassN:]ExceptionPatternN [when ExceptionGuardSeqN] ->
>        ExceptionBodyN
> end
> ...
>
> An exception occurring during the evaluation of Body is not caught."
>
>
I see. I always considered the try Expr of ... catch construction to be a
shortcut for try case Expr of ... end catch, but in this regard it isn't,
apparently.

Thanks,

Jeroen


More information about the erlang-questions mailing list