errors

Package errors provides simple error handling primitives. The traditional error handling idiom in Go is roughly akin to which when applied recursively up the call stack results in error reports without context or debugging information. The errors package allows programmers to add context to the failure path in their code in a way that does not destroy the original value of the error. The e.Wrap function returns a new error that adds context to the original error by recording a stack trace at the point Wrap is called, together with the supplied message. For example If additional control is required, the e.WithStack and e.WithMessage functions destructure e.Wrap into its component operations: annotating an error with a stack trace and with a message, respectively. Using e.Wrap constructs a stack of errors, adding context to the preceding error. Depending on the nature of the error it may be necessary to reverse the operation of e.Wrap to retrieve the original error for inspection. Any error value which implements this interface can be inspected by e.Cause. e.Cause will recursively retrieve the topmost error that does not implement causer, which is assumed to be the original cause. For example: Although the causer interface is not exported by this package, it is considered a part of its stable public interface. All error values returned from this package implement fmt.Formatter and can be formatted by the fmt package. The following verbs are supported: New, Errorf, Wrap, and Wrapf record a stack trace at the point they are invoked. This information can be retrieved with the following interface: The returned e.StackTrace type is defined as The Frame type represents a call site in the stack trace. Frame supports the fmt.Formatter interface that can be used for printing information about the stack trace of this error. For example: Although the stackTracer interface is not exported by this package, it is considered a part of its stable public interface. See the documentation for Frame.Format for more details.

MIT License

Stars
1
Committers
2

Bot releases are visible (Hide)

errors - v0.3.1 Latest Release

Published by shipengqi 4 months ago

Changelog

Bug Fixes

  • e663b12b13fcbebb9c787c94947311e3a2c448d7: fix(dependabot): update dependabot configuration (@shipengqi)
  • da1309cbc6e7ce4a6bcffd933fb78d9524d84ab1: fix(releaser): --debug has been deprecated in favor of --verbose (#30) (@shipengqi)

Other work

  • a4c59aa73fd163265786ef5badbe88aeaae4b356: chore(actions): actions should ignore goreleaser.yaml file (@shipengqi)
  • 558decbcedf965b858c6222a3add570c37912922: chore(deps): bump codecov/codecov-action from 3 to 4 (#24) (@dependabot[bot])
  • d9c5539bf832beda410262fc67a70d2a5804aa59: chore(deps): bump codecov/codecov-action from 3 to 4 (#25) (@dependabot[bot])
  • dbaf45f24645b7a91512f950d33c0d716860836c: chore(deps): bump golangci/golangci-lint-action from 3 to 4 (#26) (@dependabot[bot])
  • fcf8f6c8f5013280b6ffa22dae51d131caf4511e: chore(deps): bump golangci/golangci-lint-action from 4 to 5 (#27) (@dependabot[bot])
  • b55b3c7fc42758e7a8d8a274ec124fc6eb781579: chore(deps): bump golangci/golangci-lint-action from 5 to 6 (#28) (@dependabot[bot])
  • 9694704d836a5cb87cec6bee983afd905372b3c7: chore(deps): bump goreleaser/goreleaser-action from 5 to 6 (#29) (@dependabot[bot])
  • 3ddba6ad4c58d97effda231bbac22baf88eda077: chore(lint): add go 1.22 for golangci-lint action (@shipengqi)
  • 0ddad151b9ef08f9a7d1b82d9168fbf23ff25a56: chore(release): add goreleaser action (@shipengqi)
  • 03e8ab2daa3719a611fe75208a4a9da39c7655af: chore: add codecov token (@shipengqi)

Full Changelog: https://github.com/shipengqi/errors/compare/v0.3.0...v0.3.1

errors - 0.3.0

Published by shipengqi 9 months ago

  • Add support for Go 1.20
errors - 0.2.0

Published by shipengqi about 1 year ago

  • Add Documentation
  • Add Examples
errors - 0.1.7

Published by shipengqi about 1 year ago

  • Remove unused files
errors - 0.1.6

Published by shipengqi about 1 year ago

  • Upgrade dependencies
errors - 0.1.5

Published by shipengqi almost 2 years ago

  • fix: add callers for WithCode
errors - 0.1.4

Published by shipengqi about 2 years ago

  • Aggregate Type
errors - v0.1.3

Published by shipengqi over 2 years ago

  • Internal server error
errors - v0.1.2

Published by shipengqi over 2 years ago

  • func WrapC
  • func Codef
errors - v0.1.1

Published by shipengqi over 2 years ago

  • func RegisterC
errors - v0.1.0

Published by shipengqi over 2 years ago