-
Notifications
You must be signed in to change notification settings - Fork 4
/
errors.go
58 lines (42 loc) · 1.03 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
package truststore
import "errors"
var (
ErrNoSudo = errors.New(`"sudo" is not available`)
ErrNoKeytool = errors.New("no java keytool")
ErrNoCertutil = errors.New("no certutil tooling")
ErrNoNSS = errors.New("no NSS browser")
ErrNoNSSDB = errors.New("no NSS database")
ErrUnknownNSS = errors.New("unknown NSS install") // untested
ErrUnsupportedDistro = errors.New("unsupported Linux distrobution")
)
type Op string
const (
OpCheck Op = "check"
OpInstall = "install"
OpList = "list"
OpSudo = "sudo"
OpUninstall = "uninstall"
)
type Error struct {
Op
Fatal error
Warning error
}
func (e Error) Error() string {
if e.Fatal != nil {
return e.Fatal.Error()
}
return e.Warning.Error()
}
type NSSError struct {
Err error
CertutilInstallHelp string
NSSBrowsers string
}
func (e NSSError) Error() string { return e.Err.Error() }
type PlatformError struct {
Err error
NSSBrowsers string
RootCA string
}
func (e PlatformError) Error() string { return e.Err.Error() }