On Wednesday, February 7, 2018 at 1:26:46 AM UTC-5, Tamás Gulácsi wrote: > > backend.FilterIPs should return differentiable error - whether this is a > transient or a permanent error. > I'd use github.com/pkg/errors: > > var ErrTransient = errors.New("transient error") > > Nice, thanks.. this is along the lines of what i was thinking I needed to do. There's a slight complication.. Maybe this is a better example:
https://play.golang.org/p/y_zo_RfL5Dr it creates a gzipped buffer, truncates it slightly so the read fails, and then tries copying it to dev null. io.Copy returns: "unexpected EOF" Is there some way to inspect that error to figure out that it was related to reading from 'gr' and not writing to /dev/null? In this example I would want errors related to the reader to be wrapped as transient and errors related to the writer to be fatal, but there's a bit of a catch-22 in that I don't know how to tell which I have so I can properly wrap the error. Checking for exactly ErrUnexpectedEOF could work in this exact case, but would miss others like gzip.ErrChecksum . In my head I need something like if err.(???).ReadWriter() == gr { # error related to the reader, transient. -- 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. For more options, visit https://groups.google.com/d/optout.