3 ms·
And, in fact, bubbling errors up is very common in my code: func (t *Thing) Delete() error { count, err := db.Delete(t) if err != nil {
by randallsquared 12y ago
And, in fact, bubbling errors up is very common in my code:
func (t *Thing) Delete() error {
count, err := db.Delete(t)
if err != nil {
return err
}
if count != 1 {
return errors.New("delete Thing didn't delete 1 row? count: " + string(count))
}
return nil
}
- esailija 12y agoIndeed the majority of the time the correct way to handle an error is to propagate it up to the caller...no shit. which is why requiring manual plumbing everywhere to do just that is ridiculous. And forgetting this manual check even once is devastating. And exceptions are not the only thing that do this automatically for you, so this is just flat out horrible design decision.