Error Handling

Go errors: to wrap or not to wrap?

Exploring the tradeoffs between wrapping errors at every return site versus wrapping only at boundaries, with no definitive answer - just honest tradeoffs for the kind of software I write.

What canceled my Go context?

How Go 1.20's WithCancelCause and Go 1.21's WithTimeoutCause let you attach a reason to context cancellation, plus a gotcha with manual cancel and the stdlib pattern that covers every path.

Splintered failure modes in Go

Simplify Go error handling by consolidating validation and system errors. Learn when to return boolean vs error for clearer failure modes.

Anemic stack traces in Go

Learn how to build custom error types in Go to create stack traces without runtime overhead, inspired by Rob Pike's Upspin error handling.

Retry function in Go

Build retry logic in Go without reflection using generics. Implement exponential backoff and configurable retry strategies with type safety.