cmd/evm: Print and exit instead of panicing

This commit is contained in:
Nick Johnson 2016-10-19 12:57:42 +01:00
parent 5418d7267a
commit 9a4608b5d3

View file

@ -152,13 +152,15 @@ func run(ctx *cli.Context) error {
var err error var err error
hexcode, err = ioutil.ReadFile(ctx.GlobalString(CodeFileFlag.Name)) hexcode, err = ioutil.ReadFile(ctx.GlobalString(CodeFileFlag.Name))
if err != nil { if err != nil {
panic(err) fmt.Println("Could not load code from file: %v", err)
os.exit(1)
} }
} else { } else {
var err error var err error
hexcode, err = ioutil.ReadAll(os.Stdin) hexcode, err = ioutil.ReadAll(os.Stdin)
if err != nil { if err != nil {
panic(err) fmt.Println("Could not load code from stdin: %v", err)
os.exit(1)
} }
} }
code = common.Hex2Bytes(string(hexcode[:])) code = common.Hex2Bytes(string(hexcode[:]))