nikita-volkov / hasql-pool

A pool of connections for Hasql
http://hackage.haskell.org/package/hasql-pool
MIT License
17 stars 15 forks source link

Avoid connection-pool-poisoning by leaning on the exception handling … #3

Closed mariatsji closed 5 years ago

mariatsji commented 5 years ago

…inside Data.Pool.withResource

Firstly, TY for your great SQL-libraries!

This PR resolves the issue of Hasql.Connection.ConnectionError being returned to the Data.Pool. Data.Pool.withResource uses an onException which is not invoked on a Left value, so in order for the pool resource destruction to take place, one has to actually throw an Exception.

nikita-volkov commented 5 years ago

Thanks. I've made some changes to your code to avoid the exception-wrapping with a lower-level integration with "resource-pool" and changed the test to not require the exposure of the constructor. See 86e5b85.