You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 1, 2021. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+1-21Lines changed: 1 addition & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,26 +19,6 @@ if err != nil {
19
19
return errors.Wrap(err, "read failed")
20
20
}
21
21
```
22
-
## Retrieving the stack trace of an error or wrapper
23
-
24
-
`New`, `Errorf`, `Wrap`, and `Wrapf` record a stack trace at the point they are invoked.
25
-
This information can be retrieved with the following interface.
26
-
```go
27
-
typeStacktraceinterface {
28
-
Stacktrace() []Frame
29
-
}
30
-
```
31
-
The `Frame` type represents a call site in the stacktrace.
32
-
`Frame` supports the `fmt.Formatter` interface that can be used for printing information about the stacktrace of this error. For example
33
-
```go
34
-
iferr, ok:= err.(Stacktrace); ok {
35
-
for_, f:=range err.Stacktrace() {
36
-
fmt.Printf("%+s:%d", f)
37
-
}
38
-
}
39
-
```
40
-
See [the documentation for `Frame.Format`](https://godoc.org/github.com/pkg/errors#Frame_Format) for more details.
41
-
42
22
## Retrieving the cause of an error
43
23
44
24
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`.
@@ -57,7 +37,7 @@ default:
57
37
}
58
38
```
59
39
60
-
Would you like to know more? Read the [blog post](http://dave.cheney.net/2016/04/27/dont-just-check-errors-handle-them-gracefully).
40
+
[Read the package documentation for more information](https://godoc.org/github.com/pkg/errors).
0 commit comments