Skip to content

Commit

Permalink
Remove log.Fatal and return error message instead
Browse files Browse the repository at this point in the history
  • Loading branch information
jurichar committed Mar 16, 2024
1 parent 2eb23b9 commit d290984
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions command_catch.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package main
import (
"errors"
"fmt"
"log"
"math/rand"
)

Expand All @@ -17,7 +16,7 @@ func callbackCatch(cfg *config, args ...string) error {

pokemon, err := cfg.pokeapiClient.GetPokemon(pokemonName)
if err != nil {
log.Fatal(err)
return fmt.Errorf("%s does not exist", pokemonName)
}

fmt.Printf("Throwing a Pokeball at %s...\n", pokemonName)
Expand Down

0 comments on commit d290984

Please sign in to comment.