replace panic with log.Fatal

This commit is contained in:
filifa 2024-09-04 21:38:23 -05:00
parent 82e2b05925
commit 54f1665325
1 changed files with 6 additions and 5 deletions

View File

@ -18,6 +18,7 @@ package cmd
import ( import (
"errors" "errors"
"log"
"os" "os"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -124,23 +125,23 @@ func update(m *milkDropWindow) (bool, error) {
func milkbucket(cmd *cobra.Command, args []string) { func milkbucket(cmd *cobra.Command, args []string) {
err := checkStdin() err := checkStdin()
if err != nil { if err != nil {
panic(err) log.Fatal(err)
} }
err = sdl.Init(sdl.INIT_VIDEO) err = sdl.Init(sdl.INIT_VIDEO)
if err != nil { if err != nil {
panic(err) log.Fatal(err)
} }
defer sdl.Quit() defer sdl.Quit()
err = validatePresets() err = validatePresets()
if err != nil { if err != nil {
panic(err) log.Fatal(err)
} }
m, err := newMilkDropWindow(800, 600, presets) m, err := newMilkDropWindow(800, 600, presets)
if err != nil { if err != nil {
panic(err) log.Fatal(err)
} }
defer m.destroy() defer m.destroy()
@ -150,7 +151,7 @@ func milkbucket(cmd *cobra.Command, args []string) {
for running { for running {
running, err = update(m) running, err = update(m)
if err != nil { if err != nil {
panic(err) log.Fatal(err)
} }
} }
} }