Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return source of wrapped errors #943

Closed
wants to merge 1 commit into from
Closed

Return source of wrapped errors #943

wants to merge 1 commit into from

Conversation

wfchandler
Copy link

The Display impl for Error wraps the original error received with a message, e.g., "Communication error: {original_error_message}". The source method returns the same error, though, so iterating over the error chain will cause the same error message to be printed twice.

Update source to return the source error of the original error, not our wrapper, to avoid this duplication.

The `Display` impl for `Error` wraps the original error received with a
message, e.g., "Communication error: {original_error_message}". The
`source` method returns the same error, though, so iterating over the
error chain will cause the same error message to be printed twice.

Update `source` to return the source error of the original error, not
our wrapper, to avoid this duplication.
@wfchandler wfchandler marked this pull request as ready for review October 9, 2024 19:21
@wfchandler wfchandler requested a review from ahl October 9, 2024 19:21
@ahl
Copy link
Collaborator

ahl commented Oct 9, 2024

I'm not sure I agree with this. Based on what we learned wouldn't it be more accurate to not print information about the source in the Display impl?

@wfchandler
Copy link
Author

Agreed, this is not the right approach.

@wfchandler wfchandler closed this Oct 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants