Uh oh!
There was an error while loading. Please reload this page.
This repository was archived by the owner on Aug 17, 2024. It is now read-only.
- Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy patherrors.go
More file actions
Latest commit
59 lines (50 loc) · 1.82 KB
/
Copy patherrors.go
File metadata and controls
59 lines (50 loc) · 1.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package errors
import"github.com/pkg/errors"
// Wrap all https://github.com/pkg/errors functions
// New returns an error with the supplied message.
// New also records the stack trace at the point it was called.
funcNew(messagestring) error {
returnerrors.New(message)
}
// Errorf formats according to a format specifier and returns the string
// as a value that satisfies error.
// Errorf also records the stack trace at the point it was called.
funcErrorf(formatstring, args...interface{}) error {
returnerrors.Errorf(format, args...)
}
// WithStack annotates err with a stack trace at the point WithStack was called.
// If err is nil, WithStack returns nil.
funcWithStack(errerror) error {
returnerrors.WithStack(err)
}
// Wrap returns an error annotating err with a stack trace
// at the point Wrap is called, and the supplied message.
// If err is nil, Wrap returns nil.
funcWrap(errerror, messagestring) error {
returnerrors.Wrap(err, message)
}
// Wrapf returns an error annotating err with a stack trace
// at the point Wrapf is call, and the format specifier.
// If err is nil, Wrapf returns nil.
funcWrapf(errerror, formatstring, args...interface{}) error {
returnerrors.Wrapf(err, format, args...)
}
// WithMessage annotates err with a new message.
// If err is nil, WithMessage returns nil.
funcWithMessage(errerror, messagestring) error {
returnerrors.WithMessage(err, message)
}
// Cause returns the underlying cause of the error, if possible.
// An error value has a cause if it implements the following
// interface:
//
// type causer interface {
// Cause() error
// }
//
// If the error does not implement Cause, the original error will
// be returned. If the error is nil, nil will be returned without further
// investigation.
funcCause(errerror) error {
returnerrors.Cause(err)
}