aboutsummaryrefslogtreecommitdiff
path: root/src/errors/wrap.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/errors/wrap.go')
-rw-r--r--src/errors/wrap.go29
1 files changed, 3 insertions, 26 deletions
diff --git a/src/errors/wrap.go b/src/errors/wrap.go
index b53caa6fc9..62332b1a88 100644
--- a/src/errors/wrap.go
+++ b/src/errors/wrap.go
@@ -8,35 +8,12 @@ import (
"internal/reflectlite"
)
-// A Wrapper provides context around another error.
-type Wrapper interface {
- // Unwrap returns the next error in the error chain.
- // If there is no next error, Unwrap returns nil.
- Unwrap() error
-}
-
-// Opaque returns an error with the same error formatting as err
-// but that does not match err and cannot be unwrapped.
-func Opaque(err error) error {
- return noWrapper{err}
-}
-
-type noWrapper struct {
- error
-}
-
-func (e noWrapper) FormatError(p Printer) (next error) {
- if f, ok := e.error.(Formatter); ok {
- return f.FormatError(p)
- }
- p.Print(e.error)
- return nil
-}
-
// Unwrap returns the result of calling the Unwrap method on err, if err
// implements Wrapper. Otherwise, Unwrap returns nil.
func Unwrap(err error) error {
- u, ok := err.(Wrapper)
+ u, ok := err.(interface {
+ Unwrap() error
+ })
if !ok {
return nil
}