-
Notifications
You must be signed in to change notification settings - Fork 2k
Catch cron errors #5707
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
base: main
Are you sure you want to change the base?
Catch cron errors #5707
Conversation
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.
Pull Request Overview
This PR adds error handling for invalid cron expressions in the schedule modal and improves error display formatting throughout the app.
Key Changes
- Adds validation state to disable form submission when cron expressions are invalid
- Catches and displays errors from the cronstrue library when parsing cron expressions
- Refactors error rendering to use a consistent
errorMessageutility function
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| ui/desktop/src/components/schedule/ScheduleModal.tsx | Adds isValid state and disables submit button when cron expression is invalid |
| ui/desktop/src/components/schedule/CronPicker.tsx | Implements error handling for cron parsing with try-catch and validation callback |
| ui/desktop/src/components/ErrorBoundary.tsx | Refactors to use string errors and errorMessage utility for consistent formatting |
| ui/desktop/src/App.tsx | Updates fatal error handling to use errorMessage utility |
| try { | ||
| const cron = cronstrue.toString(cronWithoutSeconds); | ||
| isValid(true); | ||
| return cron; | ||
| } catch (e) { | ||
| isValid(false); | ||
| return 'error: ' + errorMessage(e); | ||
| } |
Copilot
AI
Nov 12, 2025
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.
Calling isValid() during render (inside getReadable()) violates React best practices - state updates should not occur during render. Move the validation logic to a useEffect that depends on currentCron, and have getReadable() only return the display string without side effects.
Summary
Show cron errors and disable submission for invalid values. also in the process noticed that any errors that bubble up sometimes just get rendered the wrong way