A comprehensive Go error handling library providing structured errors with rich context, stack traces, and debugging hints.
Oops is a Go library that provides structured error handling with rich contextual information. It acts as a drop-in replacement for Go's built-in error type, adding features like automatic stack traces, source code fragments, structured attributes, and debugging hints to make error diagnosis faster and more intuitive.
Go developers building production applications who need better error observability, debugging tools, and structured error reporting for microservices, APIs, and distributed systems.
Developers choose Oops because it provides comprehensive error context out-of-the-box without requiring extensive refactoring, integrates seamlessly with existing logging pipelines, and dramatically improves debugging efficiency with features like source fragments and annotated stack traces.
🔥 Error handling library with context, assertion, stack trace and source fragments
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Acts as a drop-in replacement for Go's error interface, enabling adoption without breaking existing code, as highlighted in the 'Drop-in Replacement' feature.
Supports adding structured attributes, user info, trace IDs, and hints via methods like With and User, transforming opaque errors into actionable insights for debugging.
Generates pretty-printed stack traces out-of-the-box with configurable depth, making error origins clear without manual instrumentation, as shown in the stack trace examples.
Offers custom formatters for major logging libraries like zap and zerolog, ensuring smooth integration into existing observability pipelines, with examples provided in the loggers section.
The builder pattern with numerous methods (e.g., In, Tags, Code) can lead to lengthy, repetitive code constructions, increasing cognitive load and potential for misuse.
Source code fragments require Go source files to be present at runtime and are disabled by default, limiting utility in production where sources might not be deployed.
The library warns about subtle behavior with Wrapf and %w verb that doesn't chain errors as expected, which could lead to bugs for developers familiar with standard fmt.Errorf.