-
Notifications
You must be signed in to change notification settings - Fork 69
/
errors.go
70 lines (52 loc) · 1.36 KB
/
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
package plugin
import (
"fmt"
)
/*
Hi Jaime! Here's where we define exit codes that the plugins will use, so that all plugins can behave in a consistent manner
*/
const SUCCESS = 0
const USAGE = 1
const UNSUPPORTED_ACTION = 2
const EXEC_FAILURE = 3
const PLUGIN_FAILURE = 4
const JSON_FAILURE = 10
const RESTORE_KEY_REQUIRED = 11
const ENDPOINT_MISSING_KEY = 12
const ENDPOINT_BAD_DATA = 13
type UnsupportedActionError struct {
Action string
}
func (e UnsupportedActionError) Error() string {
return fmt.Sprintf("The '%s' command is currently unsupported by this plugin", e.Action)
}
var UNIMPLEMENTED = UnsupportedActionError{}
type EndpointMissingRequiredDataError struct {
Key string
}
func (e EndpointMissingRequiredDataError) Error() string {
return fmt.Sprintf("No '%s' key specified in the endpoint json", e.Key)
}
type EndpointDataTypeMismatchError struct {
Key string
DesiredType string
}
func (e EndpointDataTypeMismatchError) Error() string {
return fmt.Sprintf("'%s' key in endpoint json is not of type '%s'", e.Key, e.DesiredType)
}
type ExecFailure struct {
Err string
}
func (e ExecFailure) Error() string {
return e.Err
}
type JSONError struct {
Err string
}
func (e JSONError) Error() string {
return e.Err
}
type MissingRestoreKeyError struct{}
func (e MissingRestoreKeyError) Error() string {
return "Missing required --key flag"
}