Package errors provides simple error handling primitives. The traditional error handling idiom in Go that is 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. Wrap function returns a new error that adds context to the original error. Using errors.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 errors.Wrap to retrieve the original error for inspection. Any error value which implements this interface can be inspected by errors.Cause. errors.Cause will recursively retrieve the topmost error which does not implement causer, which is assumed to be the original cause.

Features

  • Add context to an error
  • Formatted printing of errors
  • Retrieve the cause of an error
  • Retrieve the stack trace of an error or wrapper
  • 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 errors

Project Samples

Project Activity

See All Activity >

License

BSD License

Follow errors

errors Web Site

Other Useful Business Software
Stop Storing Third-Party Tokens in Your Database Icon
Stop Storing Third-Party Tokens in Your Database

Auth0 Token Vault handles secure token storage, exchange, and refresh for external providers so you don't have to build it yourself.

Rolling your own OAuth token storage can be a security liability. Token Vault securely stores access and refresh tokens from federated providers and handles exchange and renewal automatically. Connected accounts, refresh exchange, and privileged worker flows included.
Try Auth0 for Free
Rate This Project
Login To Rate This Project

User Reviews

Be the first to post a review of errors!

Additional Project Details

Programming Language

Go

Related Categories

Go Debuggers, Go Package Managers

Registered

2021-08-17