-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherror.go
More file actions
37 lines (30 loc) · 756 Bytes
/
error.go
File metadata and controls
37 lines (30 loc) · 756 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
31
32
33
34
35
36
37
// Copyright (c) 2012, SoundCloud Ltd.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Source code and contact info at http://github.com/soundcloud/visor
package visor
import (
"errors"
)
var (
ErrKeyConflict = errors.New("key is already set")
ErrUnauthorized = errors.New("operation is not permitted")
ErrInvalidState = errors.New("invalid state")
ErrNoEnt = errors.New("file not found")
)
type Error struct {
Err error
Message string
}
func NewError(err error, msg string) *Error {
return &Error{err, msg}
}
func (e *Error) Error() string {
return e.Message
}
func IsErrNoEnt(e error) (r bool) {
if err, ok := e.(*Error); ok {
r = err.Err == ErrNoEnt
}
return
}