-
Release v1.0.0 Stable
released this
2026-05-11 17:51:16 -06:00 | 1 commits to main since this releasev1.0.0
code.nochebuena.dev/go/xerrorsOverview
xerrorsv1.0.0 commits the structured error API as stable. All v0.9.0 roadmap
items are resolved. The module ships five convenience constructors covering the
most-used error codes, a complete set of thirteen typed codes aligned with gRPC
canonical status names, and the zero-import logz enrichment bridge that has been
validated in production acrosssei-apiand thehttpauthmiddleware stack.What Changed Since v0.10.0
New:
UnauthorizedandPermissionDeniedconvenience constructorsfunc Unauthorized(msg string, args ...any) *Err func PermissionDenied(msg string, args ...any) *ErrCompletes the convenience constructor set. The five most-used codes now have
dedicated constructors:Constructor Code InvalidInput(msg, args...)ErrInvalidInputNotFound(msg, args...)ErrNotFoundInternal(msg, args...)ErrInternalUnauthorized(msg, args...)ErrUnauthorized(new)PermissionDenied(msg, args...)ErrPermissionDenied(new)Less-used codes continue to use
NeworWrapdirectly.Roadmap items resolved
Item Resolution Validate all codes in production ✅ Validated in sei-api and httpauth stack Codesregistry / lookup helper✅ Decision: No — transport mapping belongs in httputilErrorContext()read-only contract✅ Documented in godoc since v0.10.0 Additional convenience constructors ✅ UnauthorizedandPermissionDeniedaddedProduction validation of logz bridge ✅ Concurrent load validated Full API (stable)
Codetype — string alias; thirteen constants (ErrInvalidInput,ErrUnauthorized,
ErrPermissionDenied,ErrNotFound,ErrAlreadyExists,ErrGone,
ErrPreconditionFailed,ErrRateLimited,ErrCancelled,ErrInternal,
ErrNotImplemented,ErrUnavailable,ErrDeadlineExceeded).
HTTP mapping belongs to the transport layer; seehttputilfor the reference implementation.New(code, message) *Err— primary factory.Wrap(code, message, cause) *Err— wraps an existing error.InvalidInput(msg, args...) *Err—ErrInvalidInput.NotFound(msg, args...) *Err—ErrNotFound.Internal(msg, args...) *Err—ErrInternal.Unauthorized(msg, args...) *Err—ErrUnauthorized. (New in v1.0.0)PermissionDenied(msg, args...) *Err—ErrPermissionDenied. (New in v1.0.0)(*Err).WithContext(key, value) *Err— attach a key-value field; chainable.(*Err).WithError(err) *Err— set or replace the cause; chainable.(*Err).WithPlatformCode(code) *Err— domain-level code for frontend i18n; chainable.(*Err).Code() Code,Message() string,PlatformCode() string,
Fields() map[string]any,Detailed() string— accessors.(*Err).ErrorCode() stringand(*Err).ErrorContext() map[string]any—
duck-type bridge for logz automatic enrichment; read-only contract onErrorContext.(*Err).MarshalJSON()—{"code":"...","platformCode":"...","message":"...","fields":{...}}.Migration from v0.10.0
No breaking changes. The only additions are
UnauthorizedandPermissionDenied.go get code.nochebuena.dev/go/xerrors@v1.0.0Downloads