-
Notifications
You must be signed in to change notification settings - Fork 0
/
parsing_errors.go
63 lines (48 loc) · 1.78 KB
/
parsing_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
package walparser
import (
"fmt"
"github.com/pkg/errors"
"github.com/tinsane/tracelog"
)
type InvalidRecordBlockIdError struct {
error
}
func NewInvalidRecordBlockIdError(blockId uint8) InvalidRecordBlockIdError {
return InvalidRecordBlockIdError{errors.Errorf("invalid record blockId: %v", blockId)}
}
func (err InvalidRecordBlockIdError) Error() string {
return fmt.Sprintf(tracelog.GetErrorFormatter(), err.error)
}
type OutOfOrderBlockIdError struct {
error
}
func NewOutOfOrderBlockIdError(actualBlockId int, expectedBlockId int) OutOfOrderBlockIdError {
return OutOfOrderBlockIdError{errors.Errorf("out of order block id: %v, expected: %v", actualBlockId, expectedBlockId)}
}
func (err OutOfOrderBlockIdError) Error() string {
return fmt.Sprintf(tracelog.GetErrorFormatter(), err.error)
}
type InconsistentBlockDataStateError struct {
error
}
func NewInconsistentBlockDataStateError(hasData bool, dataLength uint16) InconsistentBlockDataStateError {
return InconsistentBlockDataStateError{errors.Errorf("block state is inconsistent: hasData is: %v, while dataLength is: %v", hasData, dataLength)}
}
func (err InconsistentBlockDataStateError) Error() string {
return fmt.Sprintf(tracelog.GetErrorFormatter(), err.error)
}
type NoPrevRelFileNodeError struct {
error
}
func NewNoPrevRelFileNodeError() NoPrevRelFileNodeError {
return NoPrevRelFileNodeError{errors.New("expected to copy previous rel file node, but not found one")}
}
func (err NoPrevRelFileNodeError) Error() string {
return fmt.Sprintf(tracelog.GetErrorFormatter(), err.error)
}
type ContinuationNotFoundError struct {
error
}
func NewContinuationNotFoundError() ContinuationNotFoundError {
return ContinuationNotFoundError{errors.New("expected to find continuation of current xlog record, but found new records instead")}
}