Skip to content

Commit

Permalink
improve error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
aarshkshah1992 committed Sep 18, 2024
1 parent 05b84ec commit 11712bf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions chain/index/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ func (si *SqliteIndexer) sanityCheckBackfillEpoch(ctx context.Context, epoch abi
// should be less than the max non reverted height in the Index
var maxNonRevertedHeight sql.NullInt64
err := si.stmts.getMaxNonRevertedHeightStmt.QueryRowContext(ctx).Scan(&maxNonRevertedHeight)
if err != nil {
if err != nil && err != sql.ErrNoRows {
return xerrors.Errorf("failed to get max non reverted height: %w", err)
}
// couldn't find any non-reverted entries
if !maxNonRevertedHeight.Valid {
if err == sql.ErrNoRows || !maxNonRevertedHeight.Valid {
return nil
}
if epoch >= abi.ChainEpoch(maxNonRevertedHeight.Int64) {
Expand Down

0 comments on commit 11712bf

Please sign in to comment.