Documentation ¶
Overview ¶
This module implements functions which manipulate errors and provide stack trace information.
NOTE: This package intentionally mirrors the standard "errors" module. All dropbox code should use this.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FindWrappedError ¶
Performs a deep check of wrapped errors to find one which is selected by the given classifier func. The classifer is called on all non-nil errors found, starting with topErr, then on each inner wrapped error in turn until it returns non-nil which ends the scan. If the classifier ever returns a non-nil error, it will be returned from this function along with `true` to indicate something was found. Otherwise this function will return `topErr, false`.
func GetMessage ¶
func GetMessage(err interface{}) string
This returns the error string without stack trace information.
Types ¶
type DropboxError ¶
type DropboxError interface { // This returns the error message without the stack trace. GetMessage() string // This returns the wrapped error or nil if this error does not wrap another error per the // Go 2 error introspection proposal: // https://go.googlesource.com/proposal/+/master/design/29934-error-values.md Unwrap() error // Implements the built-in error interface. Error() string // Returns stack addresses as a string that can be supplied to // a helper tool to get the actual stack trace. This function doesn't result // in resolving full stack frames thus is a lot more efficient. StackAddrs() string // Returns stack frames. StackFrames() []runtime.Frame // Returns string representation of stack frames. // Stack frame formatting looks generally something like this: // dropbox/legacy_rpc.(*clientV4).Do // /srv/server/go/src/dropbox/legacy_rpc/client.go:87 +0xbf9 // dropbox/exclog.Report // /srv/server/go/src/dropbox/exclog/client.go:129 +0x9e5 // main.main // /home/cdo/tmp/report_exception.go:13 +0x84 // It is discouraged to parse stack frames using string parsing since it can change at any time. // Use StackFrames() function instead to get actual stack frame metadata. GetStack() string }
This interface exposes additional information about the error.
func New ¶
func New(msg string) DropboxError
This returns a new baseError initialized with the given message and the current stack trace.
func Newf ¶
func Newf(format string, args ...interface{}) DropboxError
Same as New, but with fmt.Printf-style parameters.
func RootDropboxError ¶
func RootDropboxError(dbxErr DropboxError) DropboxError
Return the lowest-level DropboxError. This can be used when reporting the stack of the original exception to try and get the most relevant stack instead of the highest level stack.
func Wrapf ¶
func Wrapf(err error, format string, args ...interface{}) DropboxError
Same as Wrap, but with fmt.Printf-style parameters.