forked from go-avro/avro
-
Notifications
You must be signed in to change notification settings - Fork 0
/
errors.go
57 lines (40 loc) · 2.17 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
package avro
import (
"errors"
"fmt"
"io"
)
// Signals that an end of file or stream has been reached unexpectedly.
var ErrUnexpectedEOF = io.ErrUnexpectedEOF
// Happens when the given value to decode overflows maximum int32 value.
var ErrIntOverflow = errors.New("Overflowed an int value")
// Happens when the given value to decode overflows maximum int64 value.
var ErrLongOverflow = errors.New("Overflowed a long value")
// Happens when given value to decode as bytes has negative length.
var ErrNegativeBytesLength = errors.New("Negative bytes length")
// Happens when given value to decode as bool is neither 0x00 nor 0x01.
var ErrInvalidBool = errors.New("Invalid bool value")
// Happens when given value to decode as a int is invalid
var ErrInvalidInt = errors.New("Invalid int value")
// Happens when given value to decode as a long is invalid
var ErrInvalidLong = errors.New("Invalid long value")
// Happens when given value to decode as string has either negative or undecodable length.
var ErrInvalidStringLength = errors.New("Invalid string length")
// Indicates the given file to decode does not correspond to Avro data file format.
var ErrNotAvroFile = errors.New("Not an Avro data file")
// Happens when trying to read next block without finishing the previous one.
var ErrBlockNotFinished = errors.New("Block read is unfinished")
// Happens when avro schema contains invalid value for fixed size.
var ErrInvalidFixedSize = errors.New("Invalid Fixed type size")
//// Happens when avro schema contains a union within union.
//var ErrNestedUnionsNotAllowed = errors.New("Nested unions are not allowed")
// UnionTypeOverflow happens when the numeric index of the union type is invalid.
var ErrUnionTypeOverflow = errors.New("Union type overflow")
// Happens when avro schema is unparsable or is invalid in any other way.
var ErrInvalidSchema = errors.New("Invalid schema")
// Happens when a datum reader has no set schema.
var ErrSchemaNotSet = errors.New("Schema not set")
// Specify a custom error message for indicating which necessary field in the struct is missing.
func NewFieldDoesNotExistError(field string) error {
return errors.New(fmt.Sprintf("Field does not exist: [%v]", field))
}