Skip to content

Commit

Permalink
chore: Updated error handling in main.go
Browse files Browse the repository at this point in the history
  • Loading branch information
stevedylandev committed Oct 23, 2024
1 parent 6a36d5d commit 9ef35bc
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ func main() {
Action: func(ctx *cli.Context) error {
name := ctx.Args().First()
public := ctx.Bool("public")
if name == "" {
return errors.New("Group name required")
}
_, err := CreateGroup(name, public)
return err
},
Expand Down Expand Up @@ -352,6 +355,9 @@ func main() {
Action: func(ctx *cli.Context) error {
cid := ctx.Args().First()
domain := ctx.Args().Get(1)
if cid == "" {
return errors.New("No CID provided")
}
_, err := GetSwapHistory(cid, domain)
return err
},
Expand All @@ -364,6 +370,12 @@ func main() {
Action: func(ctx *cli.Context) error {
cid := ctx.Args().First()
swapCid := ctx.Args().Get(1)
if cid == "" {
return errors.New("No CID provided")
}
if swapCid == "" {
return errors.New("No swap CID provided")
}
_, err := AddSwap(cid, swapCid)
return err
},
Expand All @@ -375,6 +387,9 @@ func main() {
ArgsUsage: "[cid]",
Action: func(ctx *cli.Context) error {
cid := ctx.Args().First()
if cid == "" {
return errors.New("No CID provided")
}
err := RemoveSwap(cid)
return err
},
Expand Down

0 comments on commit 9ef35bc

Please sign in to comment.