/plushcap/analysis/incident-io/golang-errors

Making Go errors play nice with Sentry

What's this blog post about?

The text discusses how to make Go errors work well with Sentry, an error tracking tool. It explains that standard Go errors don't have stacktraces, which makes it hard for tools like Sentry to provide much value. To address this issue, the author suggests using pkg/errors, a library that implements StackTracer errors and is compatible with Sentry. The text also covers how to wrap errors to ensure they include stacktraces and how to de-duplicate stacktraces when wrapping multiple times. Finally, it mentions creating their own version of pkg/errors to better control error production and improve compatibility with tools like Sentry.

Company
Incident.io

Date published
April 6, 2022

Author(s)
Lawrence Jones

Word count
1417

Language
English

Hacker News points
None found.


By Matt Makai. 2021-2024.