Skip to content

Commit

Permalink
fix(eibc): improve error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
artemijspavlovs committed Sep 18, 2024
1 parent 5aba973 commit 94f27a7
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion cmd/eibc/start/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,26 @@ import (
"os"
"path/filepath"

"github.com/pterm/pterm"
"github.com/spf13/cobra"

"github.com/dymensionxyz/roller/cmd/consts"
"github.com/dymensionxyz/roller/utils/bash"
eibcutils "github.com/dymensionxyz/roller/utils/eibc"
"github.com/dymensionxyz/roller/utils/filesystem"
"github.com/spf13/cobra"
)

func Cmd() *cobra.Command {
cmd := &cobra.Command{
Use: "start",
Short: "Start the eibc client",
Run: func(cmd *cobra.Command, args []string) {
pterm.Info.Println("starting eibc client")
home, _ := os.UserHomeDir()
eibcHome := filepath.Join(home, consts.ConfigDirName.Eibc)
ok, err := filesystem.DirNotEmpty(eibcHome)
if err != nil {
pterm.Error.Println("failed to check eibc home directory:", err)
return
}

Expand All @@ -43,12 +47,15 @@ func Cmd() *cobra.Command {

err = eibcutils.CreateMongoDbContainer()
if err != nil {
pterm.Error.Println("failed to create mongodb container:", err)
return
}
pterm.Info.Println("created eibc mongodb container")

c := eibcutils.GetStartCmd()
err = bash.ExecCmdFollow(c)
if err != nil {
pterm.Error.Println("failed to create mongodb container:", err)
return
}
},
Expand Down

0 comments on commit 94f27a7

Please sign in to comment.