elixir-ecto / db_connection

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

DBConnection.ConnectionError sometimes raise, sometimes returned #208

Closed jvf closed 4 years ago

jvf commented 4 years ago

Due to a crash of the database server I see lots of (concurrent) queries failing with %DBConnection.ConnectionError{message: "connection not available and request was dropped from queue ...}. In some of the cases the ConnectionError is returned as an :error tuple and in other cases the error is raised by DBConnection. Is this intended by behaviour? If so, what does returning an :error tuple vs raising indicate?

josevalim commented 4 years ago

How are you using DBConnection? The error tuple is usually controlled by whatever is wrapping DBConnection. So if you are using Ecto, the tuple is for validations and so on.

jvf commented 4 years ago

I am using DBConnection through Xandra.

The error tuple is usually controlled by whatever is wrapping DBConnection.

Do I understand you correctly: DBConnection always throws, i.e. if I see it wrapped in en error tuple this has to come Xandra?

josevalim commented 4 years ago

Exactly!

jvf commented 4 years ago

Thank you for explaining!