On Fri, 14 Feb 2025 at 14:24, Axel Wagner wrote:

On Fri, 14 Feb 2025 at 14:05, Jason E. Aten wrote:

I myself still use the classic string based-errors as 
original designed.


I'm not sure what you mean here.


I'm sorry I confused you. I'm not doing anything tricky or sophisticated at 
all.

I simply meant that I create errors with fmt.Errorf, ala `var ErrCtxRain = 
fmt.Errorf("context cancelled due to rain")`;
search them with strings.Contains(err.Error(),"i/o timeout")); and compare
them with ==, ala `if err == io.EOF || err == ErrCtxRain { ...`

This is minimum viable error(!) In other words, exactly what the error 
interface offers, and no more/no less.
Since I integrate multiple 3rd party packages, I've found this to a 
viable/sane approach to handling
their errors.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/golang-nuts/9396bb30-2c83-4592-b975-290b62bc70c1n%40googlegroups.com.

Reply via email to