-
Notifications
You must be signed in to change notification settings - Fork 627
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
feat: error handling on ticks #861
Open
JosephVoid
wants to merge
10
commits into
kelektiv:main
Choose a base branch
from
JosephVoid:feature/error-handling
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+ added error handling function param on a new constructor + added the function param on the static `from` method + caught the errors in the callback method
+ removed `@ts-expect-error line` bc it was throwing error itself
JosephVoid
changed the title
feat(error-handle): error handling on Mar 3, 2024
feat
: error handling on job.start()
job.start()
JosephVoid
changed the title
feat(error-handle): error handling on
feat: error handling on Mar 3, 2024
job.start()
job.start()
sheerlox
requested changes
Mar 7, 2024
+ Instead of a new constructor, I added the `errorHandler` on every other constructor + removed the superflous if checks + added `errorHandler` on every `return new CronJob`
Hey @sheerlox, Thanks for the review. I've incorporated all the suggestions. |
sheerlox
approved these changes
Mar 8, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thank you for your contribution @JosephVoid 🙌
sheerlox
force-pushed
the
feature/error-handling
branch
from
March 8, 2024 09:19
b3902a9
to
f13aba2
Compare
sheerlox
changed the title
feat: error handling on
feat: error handling on ticks
Mar 8, 2024
job.start()
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
I've added an error handling method in the
CronJob
class and added it to the constructors parameters. This error handling method will be called if any exception is thrown from theonTick
method. Also added two new tests to confirm that it works.Related Issue
Closes #426.
Motivation and Context
If any kind of exception occurs from the
onTick
method the whole process stops currently. To solve this, this feature will allow users to pass their own error handler when exceptions occur.How Has This Been Tested?
Added two new test cases called
should catch errors if errorhandler is provided
&should throw errors if errorhandler is NOT provided
Screenshots (if appropriate):
Types of changes
Checklist:
!
after the type/scope in the title (see the Conventional Commits standard).