Skip to content
This repository was archived by the owner on Nov 20, 2020. It is now read-only.

Commit 071f7ad

Browse files
committed
handle panics 😬
1 parent 992ee09 commit 071f7ad

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

‎main.go‎

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
package main
22

33
import (
4+
"log"
5+
"os"
6+
7+
"github.com/jesseduffield/gocui"
48
"github.com/yolossn/lazykubernetes/pkg/app"
59
"github.com/yolossn/lazykubernetes/pkg/client"
610
)
@@ -9,16 +13,19 @@ func main() {
913
// Setup k8sClient
1014
k8sClient, err := client.Newk8s()
1115
if err != nil {
12-
panic(err)
16+
log.Fatal("Couldn't connect to the k8s cluster")
1317
}
14-
// _, _ = k8sClient.GetServerInfo()
18+
1519
ui, err := app.NewApp(k8sClient)
1620
if err != nil {
17-
panic(err)
21+
log.Fatal("Something went wrong")
1822
}
1923

2024
err = ui.Run()
2125
if err != nil {
22-
panic(err)
26+
if err == gocui.ErrQuit {
27+
os.Exit(0)
28+
}
29+
log.Fatal("Something went wrong")
2330
}
2431
}

0 commit comments

Comments
 (0)