MCPcopy
hub / github.com/dropbox/godropbox / IsError

Function IsError

errors/errors.go:254–270  ·  view source on GitHub ↗

Perform a deep check, unwrapping errors as much as possilbe and comparing the string version of the error.

(err, errConst error)

Source from the content-addressed store, hash-verified

252// Perform a deep check, unwrapping errors as much as possilbe and
253// comparing the string version of the error.
254func IsError(err, errConst error) bool {
255 if err == errConst {
256 return true
257 }
258 // Must rely on string equivalence, otherwise a value is not equal
259 // to its pointer value.
260 rootErrStr := ""
261 rootErr := RootError(err)
262 if rootErr != nil {
263 rootErrStr = rootErr.Error()
264 }
265 errConstStr := ""
266 if errConst != nil {
267 errConstStr = errConst.Error()
268 }
269 return rootErrStr == errConstStr
270}
271
272// Performs a deep check of wrapped errors to find one which is selected by the given
273// classifier func. The classifer is called on all non-nil errors found, starting with topErr,

Callers

nothing calls this directly

Calls 2

RootErrorFunction · 0.85
ErrorMethod · 0.65

Tested by

no test coverage detected