-
Notifications
You must be signed in to change notification settings - Fork 51
Open
Labels
Description
Hi @dnephin!
I've been doing something like the following to check error types with errors.As:
assert.Assert(t, errors.As(err, new(*osexec.ExitError)))
It works fine, but I keep wondering if it would make sense for gotest.tools to provide a built-in assert.ErrorAs helper - something along the lines of qt.ErrorAs.
Even if we want to keep the interface simple, handling wrapped errors in Go often needs a bit of extra complexity. A helper could make these checks easier to read and more consistent. I understand that adding more surface to the interface might not be ideal, so I totally get if this doesn't fit the goals of the project. Maybe it's just worth documenting the preferred pattern somewhere?
Thank you in advance.
Related discussion: #272.