Skip to content

Commit a7bedce

Browse files
conforming function calls (#209)
1 parent 322dbff commit a7bedce

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

cmd/ability/ability.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ func AbilityCommand() (string, error) {
5959

6060
abilitiesStruct, abilityName, err := connections.AbilityApiCall(endpoint, abilityName, connections.APIURL)
6161
if err != nil {
62-
return err.Error(), nil
62+
output.WriteString(err.Error())
63+
return output.String(), err
6364
}
6465

6566
// Extract English short_effect
@@ -102,7 +103,7 @@ func AbilityCommand() (string, error) {
102103
if *pokemonFlag || *shortPokemonFlag {
103104
if err := flags.PokemonAbilitiesFlag(&output, endpoint, abilityName); err != nil {
104105
output.WriteString(fmt.Sprintf("error parsing flags: %v\n", err))
105-
return "", fmt.Errorf("error parsing flags: %w", err)
106+
return output.String(), fmt.Errorf("error parsing flags: %w", err)
106107
}
107108
}
108109

cmd/item/item.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,8 @@ func ItemCommand() (string, error) {
5050

5151
itemStruct, itemName, err := connections.ItemApiCall(endpoint, itemName, connections.APIURL)
5252
if err != nil {
53-
if os.Getenv("GO_TESTING") != "1" {
54-
fmt.Fprintln(os.Stderr, err)
55-
os.Exit(1)
56-
}
57-
return err.Error(), nil
53+
output.WriteString(err.Error())
54+
return output.String(), err
5855
}
5956

6057
itemInfoContainer(&output, itemStruct, itemName)

0 commit comments

Comments
 (0)