elixir-ecto / db_connection

Database connection behaviour
http://hexdocs.pm/db_connection/DBConnection.html
306 stars 113 forks source link

How to properly catch overloaded pool errors? #217

Closed deadtrickster closed 4 years ago

deadtrickster commented 4 years ago

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?

josevalim commented 4 years ago

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

qcam commented 4 years ago

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

josevalim commented 4 years ago

That could be handy, yes!

qcam commented 4 years ago

👍 Awesome, I can prepare a PR.

deadtrickster commented 3 years ago

@qcam ping