| 1 | package errors |
| 2 | |
| 3 | // Causer is the type of an error that may provide an error cause for |
| 4 | // error diagnosis. Cause may return nil if there is no cause (for |
| 5 | // example because the cause has been masked). |
| 6 | type Causer interface { |
| 7 | Cause() error |
| 8 | } |
| 9 | |
| 10 | // Wrapper is the type of an error that wraps another error. It is |
| 11 | // exposed so that external types may implement it, but should in |
| 12 | // general not be used otherwise. |
| 13 | type Wrapper interface { |
| 14 | // Message returns the top level error message, |
| 15 | // not including the message from the underlying |
| 16 | // error. |
| 17 | Message() string |
| 18 | |
| 19 | // Underlying returns the underlying error, or nil |
| 20 | // if there is none. |
| 21 | Underlying() error |
| 22 | } |
| 23 | |
| 24 | // Deprecated: Locationer is the old name for Locator, |
| 25 | // kept for backward compatibility only. |
| 26 | type Locationer = Locator |
| 27 | |
| 28 | // Locator can be implemented by any error type that wants to expose |
| 29 | // the source location of an error. |
| 30 | type Locator interface { |
| 31 | // Location returns the name of the file and the line number |
| 32 | // associated with an error. |
| 33 | Location() (file string, line int) |
| 34 | } |