-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherrors.go
More file actions
36 lines (28 loc) · 1.17 KB
/
errors.go
File metadata and controls
36 lines (28 loc) · 1.17 KB
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
package doppel
import (
"time"
"github.com/pkg/errors"
)
// RequestError provides additional context to errors that occur during the
// request cycle.
type RequestError struct {
error
Target string // the template the request attempted to retrieve
RequestDuration time.Duration
}
// Is returns true if the Error's underlying error matches err.
func (re RequestError) Is(err error) bool {
return re.Error() == err.Error()
}
// ErrDoppelShutdown is used in response to requests to a Doppel
// with an closed cache.
var ErrDoppelShutdown = errors.New("can't send request to stopped cache")
// ErrSchematicNotFound is used when a named TemplateSchematic isn't present
// in the Doppel's CacheSchematic.
var ErrSchematicNotFound = errors.New("requested *TemplateSchematic not found")
// ErrNotInitialized is used when a Get request is made to the
// global cache before Initialize is called.
var ErrNotInitialized = errors.New("Get was called before initializing the global cache")
// ErrAlreadyInitialized is used when the user attempts to
// call Initialize when the global cache is already running.
var ErrAlreadyInitialized = errors.New("the global cache is already running")