Closed jace-ys closed 3 weeks ago
Hi, I was going to make the same ticket, independently. This seems like a low-pain change that makes implementing a logging middleware easier.
Good call. There was no specific reason for these to not be exported other than our general hesitation to export anything without a good reason to do so. The need to use these in testing is a pretty good justification IMO!
Fixed in #665 and going out in the next release.
thanks!
Hey 👋🏻 I'm not entirely sure why
jobCancelError
andjobSnoozeError
are not exported as part of the public API, especially becausejobCancelError
also implementserrors.Is
anderrors.Unwrap
.What I'm trying to achieve is to wrap my actual
Work
functions with an instrumentedWork
helper that logs/traces job errors. Right now the only way to check if the actualWork
returnedriver.JobCancel
orriver.JobSnooze
is to do a string prefix match, which isn't ideal.For example:
If the error types were made public, I will be able to simplify this using
errors.Is(err, &river.JobCancelError{})
.