/
errors.go
113 lines (83 loc) · 2.58 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
package hidden
import (
"fmt"
"github.com/adamwalz/keybase-client/go/protocol/keybase1"
)
type ManagerError struct {
note string
}
func (e ManagerError) Error() string {
return fmt.Sprintf("hidden team manager error: %s", e.note)
}
func NewManagerError(format string, args ...interface{}) ManagerError {
return ManagerError{fmt.Sprintf(format, args...)}
}
var _ error = ManagerError{}
type LoaderError struct {
note string
}
func (e LoaderError) Error() string {
return fmt.Sprintf("hidden team loader error: %s", e.note)
}
func NewLoaderError(format string, args ...interface{}) LoaderError {
return LoaderError{fmt.Sprintf(format, args...)}
}
var _ error = LoaderError{}
type GenerateError struct {
note string
}
func (e GenerateError) Error() string {
return fmt.Sprintf("hidden team generate error: %s", e.note)
}
func NewGenerateError(format string, args ...interface{}) GenerateError {
return GenerateError{fmt.Sprintf(format, args...)}
}
var _ error = GenerateError{}
type RatchetError struct {
note string
}
func (e RatchetError) Error() string {
return fmt.Sprintf("hidden team ratchet error: %s", e.note)
}
func newRatchetError(format string, args ...interface{}) RatchetError {
return RatchetError{fmt.Sprintf(format, args...)}
}
type HiddenChainNotSupportedError struct {
teamID keybase1.TeamID
}
func NewHiddenChainNotSupportedError(teamID keybase1.TeamID) HiddenChainNotSupportedError {
return HiddenChainNotSupportedError{teamID: teamID}
}
func (e HiddenChainNotSupportedError) Error() string {
return fmt.Sprintf("hidden team chain is not enabled for team %s", e.teamID)
}
type RepeatPTKGenerationError struct {
q keybase1.PerTeamKeyGeneration
msg string
}
func newRepeatPTKGenerationError(q keybase1.PerTeamKeyGeneration, msg string) RepeatPTKGenerationError {
return RepeatPTKGenerationError{q, msg}
}
func (e RepeatPTKGenerationError) Error() string {
return fmt.Sprintf("Repeated PTK Generation found at %d (%s)", e.q, e.msg)
}
type ParentPointerError struct {
q keybase1.Seqno
msg string
}
func newParentPointerError(q keybase1.Seqno, msg string) ParentPointerError {
return ParentPointerError{q, msg}
}
func (e ParentPointerError) Error() string {
return fmt.Sprintf("hidden team parent pointer error (to visible %d): %s", e.q, e.msg)
}
type TombstonedError struct {
note string
}
func (e TombstonedError) Error() string {
return fmt.Sprintf("hidden team tombstoned error: %s", e.note)
}
func NewTombstonedError(format string, args ...interface{}) TombstonedError {
return TombstonedError{fmt.Sprintf(format, args...)}
}
var _ error = TombstonedError{}