-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy patherror.go
More file actions
30 lines (22 loc) · 696 Bytes
/
Copy patherror.go
File metadata and controls
30 lines (22 loc) · 696 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package gitignore
type Error interface {
error
// Position returns the position of the error within the .gitignore file
// (if any)
Position() Position
// Underlying returns the underlying error, permitting direct comparison
// against the wrapped error.
Underlying() error
}
type err struct {
error
_position Position
} // err()
// NewError returns a new Error instance for the given error e and position p.
func NewError(e error, p Position) Error {
return &err{error: e, _position: p}
} // NewError()
func (e *err) Position() Position { return e._position }
func (e *err) Underlying() error { return e.error }
// ensure err satisfies the Error interface
var _ Error = &err{}