Skip to content

refactor(error): wrapped error responses print using debug formatting #991

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

Closed
wants to merge 1 commit into from

Conversation

JosiahBull
Copy link
Contributor

Reasoning

Debug formatting is preferred over Display as it will also print information about wrapped errors, including stack traces, which can make debugging much easier.

Note that this was already the case with UnexpectedResponse variant, this change standardises it across all error variants.

Alternatives

Debug formatting in a Display implementation is a bit of an anti-pattern. The Error type is using the same string formatting implementation for both it's Display and Debug traits. I can split up this functionality so that the Display information can be slightly less verbose if this is desired.

Debug formatting is preferred over Display as it will also print information about wrapped errors, including stack traces, which can make debugging much easier.
@ahl
Copy link
Collaborator

ahl commented Feb 12, 2025

I don't really understand the motivation. In what situation would this be helpful?

@ahl
Copy link
Collaborator

ahl commented Feb 24, 2025

Feel free to re-open if you'd like to proceed with this.

@ahl ahl closed this Feb 24, 2025
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