-
Notifications
You must be signed in to change notification settings - Fork 568
/
errors.go
105 lines (80 loc) · 2.7 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
package types
import (
fmt "fmt"
"github.com/osmosis-labs/osmosis/osmomath"
lockuptypes "github.com/osmosis-labs/osmosis/v24/x/lockup/types"
)
var (
ErrNoPoolIDsGiven = fmt.Errorf("no pool IDs given")
ErrZeroNumEpochsPaidOver = fmt.Errorf("num epochs paid over must be greater than zero for non-perpetual gauges")
ErrUnauthorized = fmt.Errorf("unauthorized to perform this action. Must be an incentives module account")
)
type UnsupportedSplittingPolicyError struct {
GroupGaugeId uint64
SplittingPolicy SplittingPolicy
}
func (e UnsupportedSplittingPolicyError) Error() string {
return fmt.Sprintf("Attempted to sync group gauge (%d) with unsupported splitting policy: %s", e.GroupGaugeId, e.SplittingPolicy)
}
type NoPoolVolumeError struct {
PoolId uint64
}
func (e NoPoolVolumeError) Error() string {
return fmt.Sprintf("Pool %d has no volume.", e.PoolId)
}
type CumulativeVolumeDecreasedError struct {
PoolId uint64
PreviousVolume osmomath.Int
NewVolume osmomath.Int
}
func (e CumulativeVolumeDecreasedError) Error() string {
return fmt.Sprintf("Cumulative volume should not be able to decrease. Pool id (%d), previous volume (%s), new volume (%s)", e.PoolId, e.PreviousVolume, e.NewVolume)
}
type UnexpectedFinishedGaugeError struct {
GaugeId uint64
}
func (e UnexpectedFinishedGaugeError) Error() string {
return fmt.Sprintf("gauge with ID (%d) is already finished", e.GaugeId)
}
type GroupNotFoundError struct {
GroupGaugeId uint64
}
func (e GroupNotFoundError) Error() string {
return fmt.Sprintf("group with gauge ID (%d) not found", e.GroupGaugeId)
}
type GaugeNotFoundError struct {
GaugeID uint64
}
func (e GaugeNotFoundError) Error() string {
return fmt.Sprintf("gauge with ID (%d) not found", e.GaugeID)
}
type OnePoolIDGroupError struct {
PoolID uint64
}
func (e OnePoolIDGroupError) Error() string {
return fmt.Sprintf("one pool ID %d given. Need at least two to create valid Group", e.PoolID)
}
type GroupTotalWeightZeroError struct {
GroupID uint64
}
func (e GroupTotalWeightZeroError) Error() string {
return fmt.Sprintf("Group with ID %d has total weight of zero", e.GroupID)
}
type InvalidGaugeTypeError struct {
GaugeType lockuptypes.LockQueryType
}
func (e InvalidGaugeTypeError) Error() string {
return fmt.Sprintf("invalid gauge type: %s", e.GaugeType)
}
type NoVolumeSinceLastSyncError struct {
PoolID uint64
}
func (e NoVolumeSinceLastSyncError) Error() string {
return fmt.Sprintf("Pool %d has no volume since last sync", e.PoolID)
}
type DuplicatePoolIDError struct {
PoolIDs []uint64
}
func (e DuplicatePoolIDError) Error() string {
return fmt.Sprintf("one or more pool IDs provided in the pool ID array contains a duplicate: %d", e.PoolIDs)
}