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 handling] Put extra logging and propagate backtraces #192

Open
ivmarkov opened this issue Jun 22, 2024 · 0 comments
Open

[Error handling] Put extra logging and propagate backtraces #192

ivmarkov opened this issue Jun 22, 2024 · 0 comments

Comments

@ivmarkov
Copy link
Contributor

ivmarkov commented Jun 22, 2024

For a certain set of errors, specifically ErrorCodes:

  • Crypto
  • TLSStack
  • BtpError
  • MdnsError
  • NoNetworkInterface (we should actually rename this to NetworkError)
  • StdIoError
  • maybe a few more...?

... we should:

  • Always grab the original backtrace (if feature backtrace is enabled)
  • ... and keep the original error as a Box<dyn Error> (if feature std is enabled, and also in future if feature alloc is enabled given that ). Note that we currently preserve the original error only if BOTH std and backtrace are enabled, which is probably a bit too paranoid
  • Log the original error with error! otherwise

... to get extra context for debugging. Because these errors are:

  • Wrappers for lower-level errors in their respective stacks
  • We need extra info what happened for debugging

The cost of preserving the original error should not be that high as we don't expect these errors to happen frequently, but unfortunately we can only due it in the presence of alloc. Without alloc, preserving the original errors means generics which will virally pollute all our APIs which is just plain impossible to handle.

We might even decide to model these errors in a different way from the rest. To be decided.

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

No branches or pull requests

1 participant