- Notifications
You must be signed in to change notification settings - Fork514
Description
In my application I have my own error type: an enum that has several variants, one of which isDb(tokio_postgres::Error)
. When showing my error, in the case of a Postgres error, I was basically doing this:format!("DB error: {}", error)
. This is rather common: error types wrapping other errors often print some kind of prefix signalling the kind of error.
The problem is thattokio_postgres::Error
itself is already printingdb error
insome situation.
That means my error output usually is something likeDB error: db error: ...
. That's not optimal of course. But I also can't really omit my own prefix, since in other cases, Postgres' error will not printdb error
as prefix.
I would have created a PR, but I lack the knowledge what theKind::Db
represents exactly and when it is used. Is it just a "generic" kind? Would it be possible to change the"db error"
string to something else? Or at least omit it if there is a cause?