hasql
hasql copied to clipboard
Add an Exception instance to QueryError
In varying contexts I would like to be able to use throwIO
with QueryError
. Instead of wrapping it a newtype I would prefer if there was a Exception
instance already defined. I think the default instance would be fine.
So the changes would be:
data QueryError =
QueryError ByteString [Text] CommandError
deriving (Show, Eq, Typeable)
instance Exception QueryError
I don't think this will break code nor will it incur an additional dependency.
Although I feel opposed to this since I consider the presence of exceptions in Haskell altogether a mistake, this is not the first time I get this request. So okay, let's do this! Can you make a PR?
Yep. I'll make a PR.
I get the dislike of exceptions. I find them useful in tests.
Can this be closed?
Yep. Thanks. QueryError has an Exception instance now.