-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexception_code.go
More file actions
56 lines (51 loc) · 1.6 KB
/
exception_code.go
File metadata and controls
56 lines (51 loc) · 1.6 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
package aidlerrors
import (
"fmt"
)
// ExceptionCode represents an AIDL exception code sent in a reply parcel.
type ExceptionCode int32
const (
ExceptionNone ExceptionCode = 0
ExceptionSecurity ExceptionCode = -1
ExceptionBadParcelable ExceptionCode = -2
ExceptionIllegalArgument ExceptionCode = -3
ExceptionNullPointer ExceptionCode = -4
ExceptionIllegalState ExceptionCode = -5
ExceptionNetworkMain ExceptionCode = -6
ExceptionUnsupportedOperation ExceptionCode = -7
ExceptionServiceSpecific ExceptionCode = -8
ExceptionParcelable ExceptionCode = -9
ExceptionTransactionFailed ExceptionCode = -129
// Fat reply header codes — internal protocol, not real exceptions.
ExHasNotedAppOpsHeader ExceptionCode = -127
ExHasReplyHeader ExceptionCode = -128
)
// String returns a human-readable name for the exception code.
func (c ExceptionCode) String() string {
switch c {
case ExceptionNone:
return "None"
case ExceptionSecurity:
return "Security"
case ExceptionBadParcelable:
return "BadParcelable"
case ExceptionIllegalArgument:
return "IllegalArgument"
case ExceptionNullPointer:
return "NullPointer"
case ExceptionIllegalState:
return "IllegalState"
case ExceptionNetworkMain:
return "NetworkMain"
case ExceptionUnsupportedOperation:
return "UnsupportedOperation"
case ExceptionServiceSpecific:
return "ServiceSpecific"
case ExceptionParcelable:
return "Parcelable"
case ExceptionTransactionFailed:
return "TransactionFailed"
default:
return fmt.Sprintf("ExceptionCode(%d)", int32(c))
}
}