Hi HN, I'm the author of errdef.This library grew from a core idea: that by separating static error definitions (the "what") from dynamic instances (the "why"), we could resolve the common trade-offs between context, type identity, and boilerplate.This design allows you to create errors with context-specific, type-safe fields without losing their original identity.Key features:* Consistent structure for logging, metrics, and APIs* Compile-time safety for fields (DefineField[T]).* Clean integration with the Go ecosystem (errors.Is/As, fmt, json, and slog).* Extensible deserialization (JSON, Protobuf, etc.)* Built-in redaction for sensitive data (Redacted[T]).Quick example: // Define once var ErrNotFound = errdef.Define("not_found", errdef.HTTPStatus(404)) var UserID, _ = errdef.DefineField[string]("user_id") // Create instances err := ErrNotFound.With(ctx, UserID("u123")).New("user not found") // Still works with standard `errors.Is` errors.Is(err, ErrNotFound) // trueI'd love to get your feedback. How does this approach compare to the error handling patterns you use?Comments URL: https://news.ycombinator.com/item?id=45563279Points: 1# Comments: 0