Skip to content

Commit 40f13b1

Browse files
committed
fix: return error when to and from are invalid
1 parent 26e6359 commit 40f13b1

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

commands/export.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@ import (
66
"os"
77

88
"github.com/filecoin-project/go-state-types/abi"
9-
"github.com/filecoin-project/lily/chain/export"
109
"github.com/filecoin-project/lotus/blockstore"
1110
"github.com/filecoin-project/lotus/chain/store"
1211
"github.com/filecoin-project/lotus/node/repo"
1312
"github.com/mitchellh/go-homedir"
1413
"github.com/urfave/cli/v2"
1514
"golang.org/x/xerrors"
15+
16+
"github.com/filecoin-project/lily/chain/export"
1617
)
1718

1819
type chainExportOps struct {
@@ -109,7 +110,7 @@ Some examples:
109110
Before: func(cctx *cli.Context) error {
110111
from, to := chainExportFlags.from, chainExportFlags.to
111112
if to < from {
112-
xerrors.Errorf("value of --to (%d) should be >= --from (%d)", to, from)
113+
return xerrors.Errorf("value of --to (%d) should be >= --from (%d)", to, from)
113114
}
114115

115116
return nil

commands/gap.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@ import (
66
"strings"
77
"time"
88

9-
"github.com/filecoin-project/lily/chain"
10-
"github.com/filecoin-project/lily/lens/lily"
119
lotuscli "github.com/filecoin-project/lotus/cli"
1210
"github.com/urfave/cli/v2"
1311
"golang.org/x/xerrors"
12+
13+
"github.com/filecoin-project/lily/chain"
14+
"github.com/filecoin-project/lily/lens/lily"
1415
)
1516

1617
type gapOps struct {
@@ -91,7 +92,7 @@ var GapFillCmd = &cli.Command{
9192
Before: func(cctx *cli.Context) error {
9293
from, to := gapFlags.from, gapFlags.to
9394
if to < from {
94-
xerrors.Errorf("value of --to (%d) should be >= --from (%d)", to, from)
95+
return xerrors.Errorf("value of --to (%d) should be >= --from (%d)", to, from)
9596
}
9697

9798
return nil

commands/walk.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@ import (
66
"strings"
77
"time"
88

9-
"github.com/filecoin-project/lily/chain/actors/builtin"
10-
"github.com/filecoin-project/lily/lens/lily"
119
lotuscli "github.com/filecoin-project/lotus/cli"
1210
"github.com/urfave/cli/v2"
1311
"golang.org/x/xerrors"
1412

13+
"github.com/filecoin-project/lily/chain/actors/builtin"
14+
"github.com/filecoin-project/lily/lens/lily"
15+
1516
"github.com/filecoin-project/lily/chain"
1617
)
1718

@@ -92,7 +93,7 @@ var WalkCmd = &cli.Command{
9293
Before: func(cctx *cli.Context) error {
9394
from, to := walkFlags.from, walkFlags.to
9495
if to < from {
95-
xerrors.Errorf("value of --to (%d) should be >= --from (%d)", to, from)
96+
return xerrors.Errorf("value of --to (%d) should be >= --from (%d)", to, from)
9697
}
9798

9899
return nil

0 commit comments

Comments
 (0)