[julia-users] try/catch by exception type

2014-11-17 Thread Luthaf
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

Re: [julia-users] try/catch by exception type

2014-11-17 Thread Jacob Quinn
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 wrote: > Hello ! > > Is there a way to catch an exception by type in Ju

Re: [julia-users] try/catch by exception type

2014-11-17 Thread John Myles White
I don't believe this is possible in Julia right now. Which is ok in this case, since working with a KeyError is a very un-Julian way to check for key existence. You'll want to use haskey instead. -- John On Nov 17, 2014, at 2:49 PM, Luthaf wrote: > Hello ! > > Is there a way to catch an exc

Re: [julia-users] try/catch by exception type

2014-11-17 Thread Luthaf
Ok, thank you ! So the way to go is "better ask for permission than for forgiveness" ! John Myles White a écrit : I don't believe this is possible in Julia right now. Which is ok in this case, since working with a KeyError is a very un-Julian way to check for key existence. You'll want to use

Re: [julia-users] try/catch by exception type

2014-11-17 Thread John Myles White
Yes, we are civilized after all. -- John On Nov 17, 2014, at 2:53 PM, Luthaf wrote: > Ok, thank you ! > > So the way to go is "better ask for permission than for forgiveness" ! > > John Myles White a écrit : >> >> I don't believe this is possible in Julia right now. >> >> Which is ok in th