Get the latest tech news

Structured Errors in Go (2022)


Bridge the gap between structured logging and errors in Go

written almost 3 years agoThis post documents a catalogue of experiments on the topic of error management in medium-sized Go programs, specifically HTTP APIs, with certain end goals in mind around ergonomics, syntactic salt and making the lives of everyone involved easier. It made diagnosing bugs both at development time and in production vastly simpler since I had decorated many of our error returns with additional contextual metadata to aid searching in Datadog. One call to Wrap is fine but if you have a complex piece of business logic with 10 or more if err != nil's scattered around, it suddenly becomes a lot of work and that hurts the ergonomics.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of Structured Errors

Structured Errors