CAD-618 Review all uses of SomeException
erikd opened this issue · 4 comments
This code base currently catches SomeException
and in at least one place, silently swallows it:
close (P h) = hClose h `catch` (\(_ :: SomeException) -> pure ())
SomeException
is all exceptions, including things like stack and heap overflow and division by zero. Even the documentations says "It is possible to catch all exceptions, by using the type SomeException ... HOWEVER, this is normally not what you want to do!"
For the above case, it should be more than sufficient to catch IOException
and in that case, I would not mind the exception being silently swallowed, but using SomeException
there (and sliently swallowing it) is just a really bad idea.
The reason I care about this is that I am currently chasing a bug in some newly written explorer core and it currently looks like an exception is being silently swallowed. I have not finished my debugging yet.
I would also highly recommend using the bracket
pattern in place of catch
/throw
where ever possible.
I am also not a huge fan of Control.Exception.Safe
as it lulls people into the false idea that they know what they are doing when often they do not. Even worse is mixing Control.Exception
with Control.Exception.Safe
in the same project.