Skip to content

Commit

Permalink
Merge pull request hyperledger-labs#105 from dongrie/cmd-chains-add-dir
Browse files Browse the repository at this point in the history
Add return err
  • Loading branch information
siburu authored Sep 8, 2023
2 parents a75f344 + e4c140f commit 2811543
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions cmd/chains.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,20 +58,17 @@ func filesAdd(ctx *config.Context, dir string) error {
}
byt, err := os.ReadFile(pth)
if err != nil {
fmt.Printf("failed to read file %s, skipping...\n", pth)
continue
return fmt.Errorf("failed to read file %s, error: %v", pth, err)
}
var c core.ChainProverConfig
if err := json.Unmarshal(byt, &c); err != nil {
fmt.Printf("failed to unmarshal file %s, skipping...\n", pth)
continue
return fmt.Errorf("failed to unmarshal file %s, error: %v", pth, err)
}
if err := c.Init(ctx.Codec); err != nil {
return err
return fmt.Errorf("failed to init chain %s, error: %v", pth, err)
}
if err = ctx.Config.AddChain(ctx.Codec, c); err != nil {
fmt.Printf("%s: %s\n", pth, err.Error())
continue
return fmt.Errorf("failed to add chain %s, error: %v", pth, err)
}
chain, err := c.Build()
if err != nil {
Expand Down

0 comments on commit 2811543

Please sign in to comment.