Skip to content

Display implementation of signature::Error can lead to errors being printed twice #1685

@casey

Description

@casey

It's a somewhat common pattern, when an error has a underlying source, to print the error itself, and then print the source error, and so on, recursively, in error messages.

Here's an example of what this looks like in snafu:

Error: Unable to frobnicate the mumbletypeg

Caused by these errors (recent errors listed first):
  1: Could not contact the mumbletypeg API
  2: The configuration has no password

Because signature::Error both contains a source error, and includes that source error in its display implementation, this can lead to the source error being printed twice, leading to something like this:

Error: signature error: Verification equation was not satisfied

Caused by these errors (recent errors listed first):
  1: Verification equation was not satisfied

I think that given the semantics of signature::Error, it probably shouldn't have a source error. A source error is an underlying error which caused the higher level error. In the case of signature::Error, if I'm understanding it correctly, the source error really is the top level error, and not an underlying error which caused it.

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