hermez-node/common/errors.go
common/errors.goRaw
1package common
2
3import (
4 "errors"
5
6 "github.com/hermeznetwork/tracerr"
7)
8
9// ErrNotInFF is used when the *big.Int does not fit inside the Finite Field
10var ErrNotInFF = errors.New("BigInt not inside the Finite Field")
11
12// ErrNumOverflow is used when a given value overflows the maximum capacity of the parameter
13var ErrNumOverflow = errors.New("Value overflows the type")
14
15// ErrNonceOverflow is used when a given nonce overflows the maximum capacity of the Nonce (2**40-1)
16var ErrNonceOverflow = errors.New("Nonce overflow, max value: 2**40 -1")
17
18// ErrIdxOverflow is used when a given nonce overflows the maximum capacity of the Idx (2**48-1)
19var ErrIdxOverflow = errors.New("Idx overflow, max value: 2**48 -1")
20
21// ErrBatchQueueEmpty is used when the coordinator.BatchQueue.Pop() is called and has no elements
22var ErrBatchQueueEmpty = errors.New("BatchQueue empty")
23
24// ErrTODO is used when a function is not yet implemented
25var ErrTODO = errors.New("TODO")
26
27// ErrDone is used when a function returns earlier due to a cancelled context
28var ErrDone = errors.New("done")
29
30// IsErrDone returns true if the error or wrapped (with tracerr) error is ErrDone
31func IsErrDone(err error) bool {
32 return tracerr.Unwrap(err) == ErrDone
33}