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
Our Free Plans just got better! | Auth0 Icon
Our Free Plans just got better! | Auth0

With up to 25k MAUs and unlimited Okta connections, our Free Plan lets you focus on what you do best—building great apps.

You asked, we delivered! Auth0 is excited to expand our Free and Paid plans to include more options so you can focus on building, deploying, and scaling applications without having to worry about your security. Auth0 now, thank yourself later.
Try free now
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