Failure to catch an exception

The reason is return statement in finally block, which does not allow an exception from try or catch block to propagate.

I am not a core dev, but I would say it is a bug, as the documentation says:

If the try block exits due to an exception, the exception will continue propagating

but we have the following behavior (I would say this is a MWE of the problem):

julia> function h()
           try
               sqrt(-1)
           finally
               return 1
           end
       end
h (generic function with 1 method)

julia> h()
1

and exception does not propagate. If this is intended then it is not documented.

2 Likes