mirror of
https://github.com/golang/go.git
synced 2025-05-05 23:53:05 +00:00
Updated ErrorValueFAQ (markdown)
parent
a7860759db
commit
ab6ed5dd7c
@ -28,7 +28,7 @@ You need to be prepared that errors you get may be wrapped.
|
|||||||
```
|
```
|
||||||
if e := &os.PathError{}; xerrors.As(err, &e)
|
if e := &os.PathError{}; xerrors.As(err, &e)
|
||||||
```
|
```
|
||||||
- Also use this pattern to check whether an error implements an interface.
|
- Also use this pattern to check whether an error implements an interface. (This is one of those rare cases when a pointer to an interface is appropriate.)
|
||||||
- Rewrite a type switch as a sequence of if-elses.
|
- Rewrite a type switch as a sequence of if-elses.
|
||||||
|
|
||||||
## What formatting verb should I use to display errors?
|
## What formatting verb should I use to display errors?
|
||||||
|
Loading…
x
Reference in New Issue
Block a user