New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to make "createPool" fail fast when given a bad connection string? #33

runeksvendsen opened this Issue Nov 17, 2018 · 0 comments


None yet
1 participant

runeksvendsen commented Nov 17, 2018

Hi there,

Thanks for creating this library!

I have a question about how to make the following servant example using resource-pool fail immediately when given an invalid connection string:

If the main function of the example is modified to only start the server:

main :: IO ()
main = do
  -- you could read this from some configuration file,
  -- environment variable or somewhere else instead.
  -- you will need to either change this connection string OR
  -- set some environment variables (see
  -- to point to a running PostgreSQL server for this example to work.
  let connStr = ""
  pool <- initConnectionPool connStr
  runApp pool

the server will happily start without errors, but throw an exception each time a request is handled (because connStr is invalid).

Shouldn't createPool create a resource pool immediately -- and thus fail at this point -- rather than wait until withResource is called?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment