Skip to content

feat: add Detail accessor and deprecate Wrapper - #21

Merged
josuegiron merged 1 commit into
masterfrom
feat/detail-accessor
Nov 21, 2026
Merged

josuegiron merged 1 commit into
masterfrom
feat/detail-accessor

Conversation

@josuegiron

Copy link
Copy Markdown
Member

Scope

ERR-07 phase 1 of 3 (owner-approved 2026-11-21): add (*Error).Detail() and deprecate the exported Wrapper field. Leaves out removing Wrapper and dropping github.com/go-errors/errors, which ship in v0.8.0 after jgolang/log stops reading Wrapper. Not a stack; follow-ups: log v1.7.3 (switch to Detail), errors v0.8.0 (remove Wrapper and go-errors).

Reason

Wrapper *goerrors.Error ties this leaf module's public API to a third-party package, so go-errors cannot be dropped without a breaking change. log reads coded.Wrapper.Error() for its debug attribute; it needs a stable accessor first (constitution V: the replacement ships in the same release as the deprecation).

Changes

  • errors.go: func (err *Error) Detail() string returns the wrapped error's text (Wrapper.Error()), "" for a nil receiver or an error without a stack trace (a Define sentinel). Wrapper carries a Deprecated: paragraph. StackTraceStr and Error read through Detail; output unchanged.
  • Tests: table test across New, NewC, Wrap, With, WithC, WrapC, Define; nil receiver; ExampleError_Detail.
  • README.md: Stack Traces section documents Detail and the deprecation.

Verification

  • gofmt -l . empty, go vet ./... ok, go test -race ./... ok, govulncheck ./... no vulnerabilities.
  • go doc . Error shows Detail and the Deprecated: paragraph on Wrapper.
  • No hot-path change (one extra method call inside existing paths), so no benchmarks.

Release notes (v0.7.0)

  • New: (*Error).Detail() returns the text of the wrapped cause.
  • Deprecated: the Error.Wrapper field. Use Detail for the cause's text and StackTrace/StackTraceStr for the stack. Wrapper will be removed in v0.8.0 together with the github.com/go-errors/errors dependency.
  • No behavior change.

🤖 Generated with Claude Code

Detail returns the text of the wrapped cause, which log reads for its
debug attribute. The exported Wrapper field ties the public API to
github.com/go-errors/errors; it is deprecated in favor of Detail,
StackTrace and StackTraceStr and will be removed in v0.8.0 (ERR-07).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@josuegiron
josuegiron merged commit 6a62e5b into master Nov 21, 2026
2 checks passed
@josuegiron
josuegiron deleted the feat/detail-accessor branch November 21, 2026 19:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant