-
Notifications
You must be signed in to change notification settings - Fork 57
Expand file tree
/
Copy patherrors.go
More file actions
59 lines (53 loc) · 2.46 KB
/
errors.go
File metadata and controls
59 lines (53 loc) · 2.46 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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package errors
import (
"os"
)
// Code exit code
type Code int
// Error codes that are sent to the browser extension and used as exit codes in the app.
// DO NOT MODIFY THE VALUES, always append new error codes to the bottom.
const (
CodeParseRequestLength Code = 10
CodeParseRequest Code = 11
CodeInvalidRequestAction Code = 12
CodeInaccessiblePasswordStore Code = 13
CodeInaccessibleDefaultPasswordStore Code = 14
CodeUnknownDefaultPasswordStoreLocation Code = 15
CodeUnreadablePasswordStoreDefaultSettings Code = 16
CodeUnreadableDefaultPasswordStoreDefaultSettings Code = 17
CodeUnableToListFilesInPasswordStore Code = 18
CodeUnableToDetermineRelativeFilePathInPasswordStore Code = 19
CodeInvalidPasswordStore Code = 20
CodeInvalidGpgPath Code = 21
CodeUnableToDetectGpgPath Code = 22
CodeInvalidPasswordFileExtension Code = 23
CodeUnableToDecryptPasswordFile Code = 24
CodeUnableToListDirectoriesInPasswordStore Code = 25
CodeUnableToDetermineRelativeDirectoryPathInPasswordStore Code = 26
CodeEmptyContents Code = 27
CodeUnableToDetermineGpgRecipients Code = 28
CodeUnableToEncryptPasswordFile Code = 29
CodeUnableToDeletePasswordFile Code = 30
CodeUnableToDetermineIsDirectoryEmpty Code = 31
CodeUnableToDeleteEmptyDirectory Code = 32
CodeUnableToCommitPasswordFile Code = 33
)
// Field extra field in the error response params
type Field string
// Extra fields that can be sent to the browser extension as part of an error response.
// FieldMessage is always present, others are optional.
const (
FieldMessage Field = "message"
FieldAction Field = "action"
FieldError Field = "error"
FieldStoreID Field = "storeId"
FieldStoreName Field = "storeName"
FieldStorePath Field = "storePath"
FieldFile Field = "file"
FieldDirectory Field = "directory"
FieldGpgPath Field = "gpgPath"
)
// ExitWithCode exit with error code
func ExitWithCode(code Code) {
os.Exit(int(code))
}