elixir-ecto / db_connection

Database connection behaviour

Home Page:http://hexdocs.pm/db_connection/DBConnection.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to properly catch overloaded pool errors?

deadtrickster opened this issue · comments

Hi,

When checkout timeout happens DBConnection.ConnectionError raised. However it also raised in several other places and even in tests assertion uses regex for the message: ~r"connection not available and request was dropped from queue after \d+ms".

Should I use same regex matching?

Yes. I think introducing another exception for this at this point would unfortunately be a breaking change. :/

Could we maybe introduce metadata to the existing exception? Something like [reason: :checkout_timeout]?

That could be handy, yes!

👍 Awesome, I can prepare a PR.