-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make jobCancelError and jobSnoozeError public #625
Comments
Hi, |
These were initially kept as unexported types, but it turns out they're useful for testing. Still, they should not be initialized directly (i.e. from within workers) and should be used through the `JobCancel` and `JobSnooze` top level functions. Fixes #625.
These were initially kept as unexported types, but it turns out they're useful for testing. Still, they should not be initialized directly (i.e. from within workers) and should be used through the `JobCancel` and `JobSnooze` top level functions. Fixes #625.
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! |
These were initially kept as unexported types, but it turns out they're useful for testing. Still, they should not be initialized directly (i.e. from within workers) and should be used through the `JobCancel` and `JobSnooze` top level functions. Fixes riverqueue#625.
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{})
.The text was updated successfully, but these errors were encountered: