Unexpected try/catch behaviour

Jeroen Koops koops.j@REDACTED
Tue Feb 23 12:19:49 CET 2010


Here's a quick questions for the try/catch illuminati:

The following:

try
    throw(my_error)
catch
    throw:What -> { error, What }
end.

produces { error, my_error } as expected.

This:

try
    case true of
        true -> throw(my_error)
    end
catch
    throw:What -> { error, What }
end.

also gives me { error, my_error }.

But this:

try true of
    true -> throw(my_error)
catch
    throw:What -> { error, What }
end.

does not catch the exception and gives me, from the shell: ** exception
throw: my_error

Is that logical in a way I don't see?

Thanks,

Jeroen


More information about the erlang-questions mailing list