-
Notifications
You must be signed in to change notification settings - Fork 176
/
errors.go
36 lines (28 loc) · 1.04 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
package protocol
import (
"errors"
"fmt"
"github.com/onflow/flow-go/model/flow"
)
var (
// ErrNoPreviousEpoch is a sentinel error returned when a previous epoch is
// queried from a snapshot within the first epoch after the root block.
ErrNoPreviousEpoch = fmt.Errorf("no previous epoch exists")
// ErrNextEpochNotSetup is a sentinel error returned when the next epoch
// has not been set up yet.
ErrNextEpochNotSetup = fmt.Errorf("next epoch has not yet been set up")
// ErrEpochNotCommitted is a sentinel error returned when the epoch has
// not been committed and information is queried that is only accessible
// in the EpochCommitted phase.
ErrEpochNotCommitted = fmt.Errorf("queried info from EpochCommit event before it was emitted")
)
type IdentityNotFoundError struct {
NodeID flow.Identifier
}
func (e IdentityNotFoundError) Error() string {
return fmt.Sprintf("identity not found (%x)", e.NodeID)
}
func IsIdentityNotFound(err error) bool {
var errIdentityNotFound IdentityNotFoundError
return errors.As(err, &errIdentityNotFound)
}