address spelling mistakes. Thanks @seh

This commit is contained in:
Dave Cheney 2016-04-27 10:39:47 +10:00
parent 6526c1c7e1
commit cd6e0b425d
2 changed files with 7 additions and 7 deletions

View File

@ -19,17 +19,17 @@ if err != nil {
return errors.Wrap(err, "read failed")
}
```
In addition, errors.Wrap records the file and line where it was called, allowing the programmer to retrieve the path to the original error.
In addition, `errors.Wrap` records the file and line where it was called, allowing the programmer to retrieve the path to the original error.
## Retrieving the cause of an error
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 recurse the operation of errors.Wrap to retrieve the original error for inspection. Any error value which implements this interface
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 recurse 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`.
```
type causer interface {
Cause() error
}
```
Can be inspected by errors.Cause which will recursively retrieve the topmost error which does nor implement causer, which is assumed to be the original cause. For example:
`errors.Cause` will recursively retrieve the topmost error which does nor implement causer, which is assumed to be the original cause. For example:
```
switch err := errors.Cause(err).(type) {
case *MyError:

View File

@ -28,16 +28,16 @@
//
// 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 recerse the operation of errors.Wrap to retrieve the original error
// to reverse the operation of errors.Wrap to retrieve the original error
// for inspection. Any error value which implements this interface
//
// type causer interface {
// Cause() error
// }
//
// Can be inspected by errors.Cause which will recursively retrieve the topmost
// error which does nor implement causer, which is assumed to be the original
// cause. For example:
// can be inspected by errors.Cause. errors.Cause will recursively retrieve
// the topmost error which does nor implement causer, which is assumed to be
// the original cause. For example:
//
// switch err := errors.Cause(err).(type) {
// case *MyError: