Check out the somewhat lengthy, but informative thread on developing
additional functionality with regards to exception handling.
https://github.com/JuliaLang/julia/issues/7026

-Jacob

On Mon, Nov 17, 2014 at 9:49 AM, Luthaf <[email protected]> wrote:

> Hello !
>
> Is there a way to catch an exception by type in Julia ? Coming from
> python, I am very tempted to do this kind of things:
> ```
> try
>     # Access a dict here
> catch e
>     if isa(KeyError, e)
>         # Handle the KeyError, as I know what to do in that case
>     else
> # Re-throw to upper level
>         throw(e)
> end
> ```
> But that is a lot of boilerplate when used many times.
>
> Maybe it is not the Julia way to express this kind of problem (handling
> one type of exception, while letting the others go up), but I could not
> find something about it.
> I can not just remove all the exceptions as some of them are thrown by
> Base.
>
>
> Thank for yours answers !
> Guillaume
>

Reply via email to