-
Notifications
You must be signed in to change notification settings - Fork 559
/
errors.go
53 lines (40 loc) · 1.29 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
package accum
import (
"errors"
"fmt"
sdk "github.com/cosmos/cosmos-sdk/types"
)
var (
ZeroSharesError = errors.New("shares must be non-zero")
)
type NoPositionError struct {
Name string
}
func (e NoPositionError) Error() string {
return fmt.Sprintf("no position found for position key (%s)", e.Name)
}
type NegativeIntervalAccumulationPerShareError struct {
IntervalAccumulationPerShare sdk.DecCoins
}
func (e NegativeIntervalAccumulationPerShareError) Error() string {
return fmt.Sprintf("interval accumulation per share must be non-negative, was (%s)", e.IntervalAccumulationPerShare)
}
type NegativeAccDifferenceError struct {
AccumulatorDifference sdk.DecCoins
}
func (e NegativeAccDifferenceError) Error() string {
return fmt.Sprintf("difference (%s) between the old and the new accumulator value is negative", e.AccumulatorDifference)
}
type AccumDoesNotExistError struct {
AccumName string
}
func (e AccumDoesNotExistError) Error() string {
return fmt.Sprintf("Accumulator name %s does not exist in store", e.AccumName)
}
type NegativeRewardsAdditionError struct {
AccumName string
PositionName string
}
func (e NegativeRewardsAdditionError) Error() string {
return fmt.Sprintf("Attempted to add negative rewards to position %s of the accumulator %s", e.PositionName, e.AccumName)
}