aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/geth
diff options
context:
space:
mode:
authorTaylor Gerring <taylor.gerring@gmail.com>2015-06-06 22:04:13 +0800
committerTaylor Gerring <taylor.gerring@gmail.com>2015-06-06 22:04:13 +0800
commit2729e6294a22c5f1adb547078a7391ca0537ccc9 (patch)
treee86da63ca49380f6d010773ef51312f75137b15c /cmd/geth
parented621aae333ac183acc29c396c708ae57301838a (diff)
downloadgo-tangerine-2729e6294a22c5f1adb547078a7391ca0537ccc9.tar.gz
go-tangerine-2729e6294a22c5f1adb547078a7391ca0537ccc9.tar.zst
go-tangerine-2729e6294a22c5f1adb547078a7391ca0537ccc9.zip
Improved error checking
Diffstat (limited to 'cmd/geth')
-rw-r--r--cmd/geth/chaincmd.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/cmd/geth/chaincmd.go b/cmd/geth/chaincmd.go
index 2e90001af..8586e3b81 100644
--- a/cmd/geth/chaincmd.go
+++ b/cmd/geth/chaincmd.go
@@ -76,16 +76,20 @@ func exportChain(ctx *cli.Context) {
start := time.Now()
var err error
+ fp := ctx.Args().First()
if len(ctx.Args()) < 3 {
- err = utils.ExportChain(chain, ctx.Args().First())
+ err = utils.ExportChain(chain, fp)
} else {
// This can be improved to allow for numbers larger than 9223372036854775807
first, ferr := strconv.ParseInt(ctx.Args().Get(1), 10, 64)
last, lerr := strconv.ParseInt(ctx.Args().Get(2), 10, 64)
if ferr != nil || lerr != nil {
- utils.Fatalf("Export error in parsing parameters\n")
+ utils.Fatalf("Export error in parsing parameters: block number not an integer\n")
}
- err = utils.ExportAppendChain(chain, ctx.Args().First(), uint64(first), uint64(last))
+ if first < 0 || last < 0 {
+ utils.Fatalf("Export error: block number must be greater than 0\n")
+ }
+ err = utils.ExportAppendChain(chain, fp, uint64(first), uint64(last))
}
if err != nil {