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

DBConnection.ConnectionError sometimes raise, sometimes returned

jvf opened this issue · comments

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?

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.

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?

Exactly!

Thank you for explaining!