-
Notifications
You must be signed in to change notification settings - Fork 7
/
error.go
45 lines (41 loc) · 1.06 KB
/
error.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
package spice
import "fmt"
type SpiceError uint32
const (
ErrSpiceLinkOk SpiceError = iota
ErrSpiceLinkError
ErrSpiceLinkInvalidMagic
ErrSpiceLinkInvalidData
ErrSpiceLinkVersionMismatch
ErrSpiceLinkNeedSecured
ErrSpiceLinkNeedUnsecured
ErrSpiceLinkPermissionDenied
ErrSpiceLinkBadConnectionId
ErrSpiceLinkChannelNotAvailable
)
func (e SpiceError) Error() string {
switch e {
case ErrSpiceLinkOk:
return "spice: OK"
case ErrSpiceLinkError:
return "spice: Error"
case ErrSpiceLinkInvalidMagic:
return "spice: Invalid magic"
case ErrSpiceLinkInvalidData:
return "spice: Invalid data"
case ErrSpiceLinkVersionMismatch:
return "spice: Version mismatch"
case ErrSpiceLinkNeedSecured:
return "spice: Need secured"
case ErrSpiceLinkNeedUnsecured:
return "spice: Need unsecured"
case ErrSpiceLinkPermissionDenied:
return "spice: Permission denied"
case ErrSpiceLinkBadConnectionId:
return "spice: bad connection id"
case ErrSpiceLinkChannelNotAvailable:
return "spice: channel not available"
default:
return fmt.Sprintf("SpiceError(%d)", e)
}
}