-
Notifications
You must be signed in to change notification settings - Fork 0
/
errors.go
64 lines (51 loc) · 1.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
package types
import (
"fmt"
time "time"
)
type EndTimeInFutureError struct {
EndTime time.Time
BlockTime time.Time
}
func (e EndTimeInFutureError) Error() string {
return fmt.Sprintf("called GetArithmeticTwap with an end time in the future."+
" (end time %s, current time %s)", e.EndTime, e.BlockTime)
}
type StartTimeAfterEndTimeError struct {
StartTime time.Time
EndTime time.Time
}
func (e StartTimeAfterEndTimeError) Error() string {
return fmt.Sprintf("called GetArithmeticTwap with a start time that is after the end time."+
" (start time %s, end time %s)", e.StartTime, e.EndTime)
}
type KeySeparatorLengthError struct {
ExpectedLength int
ActualLength int
}
func (e KeySeparatorLengthError) Error() string {
return fmt.Sprintf("key separator is an incorrect length."+
" (expected length %d, actual length %d)", e.ExpectedLength, e.ActualLength)
}
type UnexpectedSeparatorError struct {
ExpectedSeparator string
ActualSeparator string
}
func (e UnexpectedSeparatorError) Error() string {
return fmt.Sprintf("separator is incorrectly formatted."+
" (expected separator %s, actual separator %v)", e.ExpectedSeparator, e.ActualSeparator)
}
type TimeStringKeyFormatError struct {
Key string
Err error
}
func (e TimeStringKeyFormatError) Error() string {
return fmt.Sprintf("incorrectly formatted time string in key %s : %v", e.Key, e.Err)
}
type InvalidRecordCountError struct {
Actual int
Expected int
}
func (e InvalidRecordCountError) Error() string {
return fmt.Sprintf("The number of records do not match, expected: %d\n got: %d", e.Expected, e.Actual)
}