Skip to content
This repository was archived by the owner on Sep 12, 2024. It is now read-only.
This repository was archived by the owner on Sep 12, 2024. It is now read-only.

When should Display of Error also print the cause? #23

Open
@mahkoh

Description

@mahkoh

anyhow prints the cause chain only with {:#} but tokio-postgres always prints the cause. This causes rust-postgres errors wrapped in anyhow errors to be printed twice if at all.

            log::error!("postgres connection failed: {:#}", e);
postgres connection failed: db error: FATAL: terminating connection due to administrator command: FATAL: terminating connection due to administrator command

https://github.com/sfackler/rust-postgres/blob/8f2ae8647bd2de68a77d85bfb005de3cfdd548a3/tokio-postgres/src/error/mod.rs#L396-L398

https://github.com/dtolnay/anyhow/blob/5e4177fc4c9e211feb90f1d81ea0ef183f171fa7/src/fmt.rs#L9-L13

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