▲ | Cthulhu_ a day ago | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
This is down to developer style and agreements though; Go has typed errors and a set of utilities to match them [0]. Not using those is a choice, just like how in Java you can just `catch (Exception e)` after calling a dozen methods that might each throw a different exception. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
▲ | Yoric a day ago | parent [-] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Interestingly, every time (and I mean _every_ time) that I've tried to use `errors.As` on errors raised by lib code, I found out that the lib just went with "nah, I'm just going to use `errors.New` or `fmt.Errorf`", which makes the error impossible to match. So... I'd say that this is a fumble in the design of Go. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|