-
Notifications
You must be signed in to change notification settings - Fork 59
/
Copy pathcodes.go
52 lines (35 loc) · 1.37 KB
/
codes.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
package butlerd
import "fmt"
var _ Error = Code(0)
var codeMessages = map[Code]string{
CodeOperationCancelled: "The operation was cancelled.",
CodeOperationAborted: "The operation was aborted.",
CodeInstallFolderDisappeared: "Launch was unsuccessful because install folder disappeared",
CodeNoCompatibleUploads: "No compatible uploads were found.",
CodeUnsupportedPackaging: "This title is packaged in a way that is not supported.",
CodeUnsupportedHost: "This title is hosted on an incompatible third-party website",
CodeNoLaunchCandidates: "Nothing that can be launched was found.",
CodeJavaRuntimeNeeded: "Java Runtime Environment is required to launch this title.",
CodeNetworkDisconnected: "There is no Internet connection",
CodeAPIError: "API error",
CodeDatabaseBusy: "The database is busy",
CodeCantRemoveLocationBecauseOfActiveDownloads: "An install location could not be removed because it has active downloads",
}
func (code Code) RpcErrorMessage() string {
if msg, ok := codeMessages[code]; ok {
return msg
}
return fmt.Sprintf("butlerd error %d", code)
}
func (code Code) RpcErrorCode() int64 {
return int64(code)
}
func (code Code) RpcErrorData() map[string]interface{} {
return nil
}
func (code Code) Error() string {
return code.RpcErrorMessage()
}
func (code Code) String() string {
return fmt.Sprintf("butlerd error: %s", code.Error())
}