You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We're not always doing a good job at reporting errors.
A few factors for this:
we rely on tracing::instrument(err) for logging when some function fails. This usually means that when an error bubbles up, it gets logged multiple times, with many times a lot of the tracing context in it
we don't consistently report them to sentry. In a lot of cases, we have a RouteError that calls sentry::capture_error, but we're missing that in multiple places
we use a mix of thiserror and anyhow, not very consistently. The fact that anyhow::Error doesn't implement std::error::Error is annoying
we often want to attach random string context to errors, which is annoying to do. In syn2mas we started using thiserror-ext exactly for that
we don't collect enough infos on errors. It would be nice to capture the code location where it was emitted, maybe the span context as well
Snafu looks nice to do all this:
it covers both the 'error derive macro' like thiserror and the 'whatever' error like anyhow
it automatically creates helper to add context on results, bundling the source error
when gathering context, it can automatically gather stuff like the backtrace, the code location or the span context
it's overall more opinionated, in a good way?
it adopts the new error 'provide' API. We could use that to try to define well-known error codes so that we can translate those to users?
We can try to gradually adopt it, as it works well with any error that implements std::error::Error anyway (which is the case for most of our code)
We're not always doing a good job at reporting errors.
A few factors for this:
tracing::instrument(err)
for logging when some function fails. This usually means that when an error bubbles up, it gets logged multiple times, with many times a lot of the tracing context in itsentry::capture_error
, but we're missing that in multiple placesanyhow::Error
doesn't implementstd::error::Error
is annoyingthiserror-ext
exactly for thatSnafu looks nice to do all this:
We can try to gradually adopt it, as it works well with any error that implements std::error::Error anyway (which is the case for most of our code)
Related to #1488
The text was updated successfully, but these errors were encountered: