rotisserie/eris

Add eris.As(...)

morningvera opened this issue · 4 comments

For completion, we should offer an As method like the one in Go 1.13 errors (https://golang.org/pkg/errors/#As). We should try to make this more reliable than Go's version by preventing panics: "As will panic if target is not a non-nil pointer to either a type that implements error, or to any interface type." Seems like we could just return false in these cases instead.

Hi @morningvera , any update on this feature? Maybe I can help with it?

Hey @Dragomir-Ivanov, thanks for the offer to help! This is turning out to be more complicated than anticipated. I've had a branch in progress that relates to this (as well as both #81 and #82). I'm going to spend a few hours today and tomorrow to see if I can finish that work because I think it'll affect the implementation of this. I'll let you know how it goes soon.

@morningvera Thanks mate! Just noticed that Sentry integration doesn't work quite correct.
Sentry displays the wrapped errors, but not their call-stack info. I don't have time right not to dig, if that is Eris, or Sentry fault. You can test this with the provided example:

go run examples/sentry/example.go -dsn=<Valid Sentry DSN>

@Dragomir-Ivanov thanks for reporting that, would you mind adding a separate issue for it when you get a chance?