Closed domenkozar closed 5 years ago
I must say that I'm a bit conflicted about that. On the one hand it's just a simple instance, which doesn't break any APIs, on the other it goes against my intention of establishing an exceptionless workflow. Can you provide more details on your motivation and maybe some arguments?
@nikita-volkov I use exceptions within HTTP request handling to trigger HTTP 500 response if SQL connection fails. I really enjoy hasql being exceptionless, but servant only uses exceptions to trigger non-200 responses.
Seems like it's the issue of Servant. Have you tried reporting it there?
It's by design to use exception in Servant. I don't see how this would hurt hasql by providing an instance so that code outside the library can use it instead of relying on orphans.
Well, it's also by design not to use exceptions in Hasql and Hasql's error messages are not exceptions, so it doesn't make sense to make them the instances of. Also I don't believe that it would be correct of me to rely the design decisions on the arguments about convenience of interaction with any third-party library, because thus I would introduce a dependency of Hasql's design on the design of the other library.
Concerning Servant, it doesn't seem like a stopper issue in terms of integration with it, since you can use custom wrapper types, which are exceptions, to pack Hasql errors when you actually do throw exceptions.
Makes escalation via MonadThrow easier.