Skip to content

User defined error from transactions? #4658

Answered by weiznich
kriswuollett asked this question in Q&A
Discussion options

You must be logged in to vote

I'm still not able to follow you on why you need to use diesel::result::Error as error type there. It is designed to be used as diesel error type, not as general error type for any other application. From this design perspective the first suggested solution doesn't seem meaningful.

For me the second solution is completely unclear.

Implementing From<diesel’s Error> does not make sense since it seems to be only for actual database generated errors.

To clarify that: This E: From<diesel::result::Error> impl is exactly used for that is case of an error generated by interacting the the transaction (and not the closure) itself. That can also fail due to network errors, etc like any other datab…

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@kriswuollett
Comment options

@weiznich
Comment options

Answer selected by kriswuollett
@kriswuollett
Comment options

@kriswuollett
Comment options

@weiznich
Comment options

@kriswuollett
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants