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

Error type should not use #[source] if the inner error get printed together with the error itself #3193

Open
ultimaweapon opened this issue Apr 11, 2024 · 0 comments
Labels

Comments

@ultimaweapon
Copy link

My application heavily rely on std::error::Error::source to propagate the error from the lower components to the top-level component. The top-level component responsible for printing the error and its nested errors. The problem is when I use the same function that I used to print my errors to print the sqlx::Error I got an output with redundant information:

[2024/04/11 13:05][Error]: Failed to log REDACTED: error returned from database: 1146 (42S02): Table 'REDACTED' doesn't exist -> 1146 (42S02): Table 'REDACTED' doesn't exist.

Notice the duplicated 1146 (42S02): Table 'REDACTED' doesn't exist. After checking on the implementation of sqlx::Error what I found is it apply #[source] to the inner error while also print it together with the current error, which causing the duplicated message on the above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant