| |
| ▲ | Yoric 7 hours ago | parent | next [-] | | It would, if people actually defined new errors. But, as I mentioned in my message, people just use `errors.New` or `fmt.Errorf`, all the way down, so you end up with errors that cannot be matched. Which means, in turn, that if these are errors that should be handled properly (and not just propagated/logged), they cannot. | |
| ▲ | the_gipsy 21 hours ago | parent | prev [-] | | How? Stringly matching? That's not typesafe at all. | | |
| ▲ | wbl 18 hours ago | parent [-] | | No it wraps the underlying error | | |
| ▲ | the_gipsy 9 hours ago | parent [-] | | But the underlying error stays unmatchable. Doesn't sound like a solution if you have to duplicate every error type, and worse, they don't even map 1:1 but now you have the same underlying error wrapped to god knows how many different errors. For example, the lib produces some an error "bad file descriptor". You'll be wrapping it when you call fileOpen, fileDelete, etc etc 20 times. So you will be wrapping it in "open error", "delete error", etc, 20 times. You cannot try to match it to "bad file descriptor", that information is lost, you now have 20 relatively useless errors. Except if you stringly match. | | |
|
|
|