wrap Errno, implement xerrors.Wrapper
(err error, suffix string)
| 44 | |
| 45 | // wrap Errno, implement xerrors.Wrapper |
| 46 | func Exception(err error, suffix string) error { |
| 47 | no, ok := err.(syscall.Errno) |
| 48 | if !ok { |
| 49 | if suffix == "" { |
| 50 | return err |
| 51 | } |
| 52 | return fmt.Errorf("%s %s", err.Error(), suffix) |
| 53 | } |
| 54 | return &exception{no: no, suffix: suffix} |
| 55 | } |
| 56 | |
| 57 | var _ net.Error = (*exception)(nil) |
| 58 |
searching dependent graphs…