Skip to content

Bump github.com/bdlm/errors/v2 from 2.1.2 to 2.2.0 - #3

Closed
dependabot[bot] wants to merge 1 commit into
mainfrom
dependabot/go_modules/github.com/bdlm/errors/v2-2.2.0
Closed

Bump github.com/bdlm/errors/v2 from 2.1.2 to 2.2.0#3
dependabot[bot] wants to merge 1 commit into
mainfrom
dependabot/go_modules/github.com/bdlm/errors/v2-2.2.0

Conversation

@dependabot

@dependabot dependabot Bot commented on behalf of github Aug 27, 2026

Copy link
Copy Markdown

Bumps github.com/bdlm/errors/v2 from 2.1.2 to 2.2.0.

Release notes

Sourced from github.com/bdlm/errors/v2's releases.

v2.2.0: Match the standard library's As signature

Changed

  • As now matches the standard library's signature, As(err error, target interface{}) bool, replacing As(err, test error) error.

Fixed

Eight defects, all found by a new contract test suite (contract_test.go) organised by obligation rather than by function. Coverage 95.9%, race-clean.

  • Panics on nil. doc.go promises every method works with nil values; four did not. (*E).Error, (*E).Is and (*E).MarshalJSON dereferenced a nil receiver, and (*E).Is also panicked whenever the frame carried no annotation of its own — reflect.TypeOf(nil) returns a NIL reflect.Type, and calling Comparable on that panics rather than answering false. The package-level Is had the same flaw. Both now share a comparableErrors helper.
  • **New and Wrap corrupted any message contain

v2.1.4: Traverse multi-errors in Is and As

Fixed

  • Is and As now traverse multi-errors. An error may wrap several causes — errors.Join, or fmt.Errorf with more than one %w — and those implement Unwrap() []error, which the single-error Unwrap cannot express.
  • Unwrap still returns nil for a multi-error, as std/errors.Unwrap does — there is no single previous error to return. This is now documented rather than implicit; callers walking a chain themselves must branch on Unwrap() []error.

v2.1.3: Make wrapped errors visible to the standard errors package

Added

  • Interoperation tests against the standard library's errors package (interop_test.go).

Changed

  • func (e *E) Unwrap() error now returns the wrapped error itself. It previously re-boxed a wrapped error that did not implement std/errors.Error as &E{err: prev}. That box carried no prev, so the chain ended there and the original error value was never handed to the caller — its own Unwrap, Is and As were never consulted. The consequence was that errors.As could only ever match *E, since no other concrete type was ever yielded, so anything built on errors.As could not see through a wrap. gRPC is the sharpest example: status.FromError is errors.As for an interface{ GRPCStatus() *Status }, so a wrapped status error was reported as codes.Unknown — an HTTP 500 — including for failures that were plainly the caller's fault, such as an unacceptable auth token.
  • func Is(err, test error) bool no longer ends the walk early. It returned the first link's Is answer directly; every *E has an Is method, so a false there ended the search and a sentinel further down was unreachable. A negative answer from one link now continues to the next. func (e *E) Is(error) bool is unchanged and still searches the chain — the standard library calls that hook as ok && x.Is(target), so its answer never terminated errors.Is's own walk.
  • func (e *E) Error() string includes the wrapped message, "outer: inner", as fmt.Errorf("%w") produces. Returning only the frame's own message discarded everything beneath it wherever an error is rendered through Error() rather than a %+v verb — which is most of the places that reach a user, including an HTTP or gRPC response body. The trace and JSON formats print one line per frame and now use each frame's own message, so their output is unchanged.
Changelog

Sourced from github.com/bdlm/errors/v2's changelog.

v2.2.0 - 2026-08-21

Changed

  • As now matches the standard library's signature, As(err error, target interface{}) bool, replacing As(err, test error) error.

    The old form required the target to satisfy error, which had two consequences. A caller could not ask for a bare interface type at all — &interface{ GRPCStatus() *Status }{} is not an error — which is the most common real question to ask of a chain. And for concrete types the target's receiver kind leaked into the call: a type with a pointer receiver could not be asked for, so callers picked value receivers to make the call compile rather than because the type wanted one.

    It also meant the package's own helper did not match the library it aims to implement, so code moving between errors.As and bdlm/errors.As had to change shape as well as import path.

    Migration. if found := errors.As(err, target); nil != found { ... } becomes if errors.As(err, &target) { ... }, with target declared as the type or interface being sought. Note the address-of: the standard library takes a pointer to the target.

    As now panics on a target that is not a non-nil pointer to an error-implementing type or to an interface, again matching the standard library. An unusable target cannot match anything, so answering "not found" would hide a call-site mistake in precisely the paths that are hardest to observe. A nil error is still an ordinary false.

    The As(interface{}) bool hook on *E is unchanged; the old As(error) error hook shape is no longer consulted.

Fixed

Eight defects, all found by a new contract test suite (contract_test.go) organised by obligation rather than by function. Coverage 95.9%, race-clean.

  • Panics on nil. doc.go promises every method works with nil values; four did not. (*E).Error, (*E).Is and (*E).MarshalJSON dereferenced a nil receiver, and (*E).Is also panicked whenever the frame carried no annotation of its own — reflect.TypeOf(nil) returns a NIL reflect.Type, and calling Comparable on that panics rather than answering false. The package-level Is had the same flaw. Both now share a comparableErrors helper.
  • New and Wrap corrupted any message containing a percent sign. Both passed the message through fmt.Errorf, so New("100% complete") produced "100%!c(MISSING)omplete" and "disk usage at 95%" produced "...95%!(NOVERB)". A message is now stored verbatim; only Errorf, and Wrap when given arguments, formats.
  • MarshalJSON panicked on a foreign wrapper in the chain. list() includes any error implementing Unwrap() error, so a fmt.Errorf("%w") link reached an unguarded type assertion and a nil field read. Marshalling an error must never panic — it runs while something is already failing.
  • Trace severed the chain. It held the wrapped error in the annotation slot and left prev nil, so Unwrap returned nothing and no sentinel below a trace was reachable. The error is now on the chain, and a frame with no message of its own renders transparently.
  • Track severed the chain for anything that was not already an *E. prev came from a synthetic box whose own prev was nil, so a fmt.Errorf("%w") wrapper, a joined error, or any foreign wrapping type lost everything beneath it.

... (truncated)

Commits
  • 3da1e1c v2.2.0: Match the standard library's As signature (#22)
  • ca4b60c v2.1.4: Traverse multi-errors in Is and As (#21)
  • a191a75 v2.1.3: Make wrapped errors visible to the standard errors package (#20)
  • ac87894 readme update
  • cb6b18f readme update
  • 4816e98 readme update, package upgrade
  • See full diff in compare view

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

Bumps [github.com/bdlm/errors/v2](https://github.com/bdlm/errors) from 2.1.2 to 2.2.0.
- [Release notes](https://github.com/bdlm/errors/releases)
- [Changelog](https://github.com/bdlm/errors/blob/main/CHANGELOG.md)
- [Commits](bdlm/errors@v2.1.2...v2.2.0)

---
updated-dependencies:
- dependency-name: github.com/bdlm/errors/v2
  dependency-version: 2.2.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
@dependabot dependabot Bot added dependencies Pull requests that update a dependency file go Pull requests that update go code labels Aug 27, 2026
@dependabot @github

dependabot Bot commented on behalf of github Sep 3, 2026

Copy link
Copy Markdown
Author

Superseded by #4.

@dependabot dependabot Bot closed this Sep 3, 2026
@dependabot
dependabot Bot deleted the dependabot/go_modules/github.com/bdlm/errors/v2-2.2.0 branch September 3, 2026 14:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file go Pull requests that update go code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants