-
-
Notifications
You must be signed in to change notification settings - Fork 286
/
errors.go
39 lines (29 loc) · 906 Bytes
/
errors.go
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
38
39
package server
import (
"emperror.dev/errors"
)
var (
ErrIsRunning = errors.New("server is running")
ErrSuspended = errors.New("server is currently in a suspended state")
ErrServerIsInstalling = errors.New("server is currently installing")
ErrServerIsTransferring = errors.New("server is currently being transferred")
ErrServerIsRestoring = errors.New("server is currently being restored")
)
type crashTooFrequent struct {
}
func (e *crashTooFrequent) Error() string {
return "server has crashed too soon after the last detected crash"
}
func IsTooFrequentCrashError(err error) bool {
_, ok := err.(*crashTooFrequent)
return ok
}
type serverDoesNotExist struct {
}
func (e *serverDoesNotExist) Error() string {
return "server does not exist on remote system"
}
func IsServerDoesNotExistError(err error) bool {
_, ok := err.(*serverDoesNotExist)
return ok
}