3 ms·
Uh, no, it's just bad code. Don't get me wrong, error handling is verbose and annoying, but not even displaying actual error is just horrible coding practice.
by ilyt 4y ago
Uh, no, it's just bad code.
Don't get me wrong, error handling is verbose and annoying, but not even displaying actual error is just horrible coding practice.
should be at the very least
err = json.Unmarshal(weatherBody, &WeatherRes)
if err != nil {
fmt.Printf("error decoding weather json: %s\n",err)
return
}
or just be function that returns that error or the weather
err = json.Unmarshal(weatherBody, &WeatherRes)
if err != nil {
return fmt.Errorf("error decoding weather json: %s\n",err)
}