package
0.0.0-20220323014127-0e85dd5dcadd
Repository: https://github.com/stevenacoffman/anotherr.git
Documentation: pkg.go.dev

# README

This package aims to be used as a drop-in replacement to github.com/pkg/errors and Go's standard errors package.

Compatibility with Khan webapp errors is also provided, but instead of Wrap, use KhanWrap. All other functions, like NotFound(args ...interface{}) should be drop-in replacements.

Additionally, it provides all the benefits of cockroachdb/errors:

  • it provides Wrap primitives akin to those found in github.com/pkg/errors.
  • it is compatible with both the causer interface (Cause() error) from github.com/pkg/errors and the Wrapper interface (Unwrap() error) from Go 2.
  • it enables fast, reliable and secure determination of whether a particular cause is present (not relying on the presence of a substring in the error message).
  • Stack traces for troubleshooting
  • it is composable, which makes it extensible with additional error annotations; for example, the basic functionality has HTTP error codes.

# Packages

No description provided by the author
No description provided by the author
No description provided by the author

# Functions

As finds the first error in err's chain that matches the type to which target points, and if so, sets the target to its value and returns true.
Cause aliases UnwrapAll() for compatibility with github.com/pkg/errors.
Errorf aliases Newf().
GetFields retrieves the Fields from a stack of causes.
GetOneLineSource extracts the file/line/function information of the topmost caller in the innermost recorded stack trace.
GetReportableStackTrace extracts a stack trace embedded in the given error in the format suitable for Sentry reporting.
GraphqlResponse creates an error of kind GraphqlResponseKind.
Internal creates an error of kind InternalKind.
InvalidInput creates an error of kind InvalidKind.
Is determines whether one of the causes of the given error or any of its causes is equivalent to some reference error.
KhanService creates an error of kind KhanServiceKind.
KhanWrap takes a khanError as input and some new field key/value pairs, and returns a new error that has the same "kind" as the existing error, plus the specified key/value pairs.
New creates an error with a simple error message.
Newf creates an error with a formatted error message.
NewWithDepth is like New() except the depth to capture the stack trace is configurable.
NewWithDepthf is like Newf() except the depth to capture the stack trace is configurable.
NotAllowed creates an error of kind NotAllowedKind.
NotFound creates an error of kind NotFoundKind.
NotImplemented creates an error of kind NotImplementedKind.
Service creates an error of kind ServiceKind.
TransientKhanService creates an error of kind TransientKhanServiceKind.
TransientService creates an error of kind TransientServiceKind.
Unauthorized creates an error of kind UnauthorizedKind.
Unwrap aliases UnwrapOnce() for compatibility with xerrors.
WithMessage annotates err with a new message.
WithMessagef annotates err with the format specifier.
WithStack annotates err with a stack trace at the point WithStack was called.
WithStackDepth annotates err with a stack trace starting from the given call depth.
Wrap wraps an error with a message prefix.
Wrapf wraps an error with a formatted message prefix.
WrapWithDepth is like Wrap except the depth to capture the stack trace is configurable.
WrapWithDepthf is like Wrapf except the depth to capture the stack trace is configurable.
WrapWithFields adds fields to an existing error.
WrapWithFieldsAndDepth adds fields to an existing error and captures the stacktrace.

# Constants

GraphqlResponseKind means that the graphql server returned an error code as part of the graphql response.
InternalKind means that the function failed for a reason unrelated to its input or problems working with a remote system.
InvalidInputKind means that there was a problem with the provided input.
KhanServiceKind means that there was a non-transient problem when contacting another Khan service.
NotAllowedKind means that there was a problem due to the state of the system not matching the requested operation or input.
NotFoundKind means that some requested resource wasn't found.
NotImplementedKind means that the function isn't implemented.
ServiceKind means that there was a non-transient problem when making a request to a non-Khan service, e.g.
TransientKhanServiceKind means that there was a problem when contacting another Khan service that might be resolvable by retrying.
TransientServiceKind means that there was a problem when making a request to a non-Khan service, e.g.
UnauthorizedKind means that there was an access control problem.
UnspecifiedKind means that no error kind was specified.

# Interfaces

Wrapper is the type of an error wrapper.

# Type aliases

No description provided by the author
ReportableStackTrace aliases the type of the same name in the sentry package.