Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Display impl ofError is not optimal #831

Open
@LukasKalbertodt

Description

@LukasKalbertodt

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.

https://github.com/sfackler/rust-postgres/blob/d45461614aca87022c17a2cc26b22325bf161fa5/tokio-postgres/src/error/mod.rs#L377-L403

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp