Skip to content

Exit gracefully when no meeting found instead of throwing error - #203

Merged
ovflowd merged 4 commits into
mainfrom
copilot/fix-9950313-108046388-d06d2156-c4d2-4244-a7c5-102f7480459d
Nov 4, 2025
Merged

ovflowd merged 4 commits into
mainfrom
copilot/fix-9950313-108046388-d06d2156-c4d2-4244-a7c5-102f7480459d

Conversation

Copilot AI commented Nov 3, 2025 •

Copy link
Copy Markdown
Contributor

When no meeting is found in the calendar (common for bi-weekly meetings), the script threw an error. Changed to exit with code 0 and log an informative message.

Changes

  • src/calendar.mjs: findNextMeetingDate() returns null instead of throwing. Exported getWeekBounds() for reuse.
  • create-node-meeting-artifacts.mjs: Check for null meeting date, log message, exit 0.
  • test/calendar.test.mjs: Added tests covering null return scenarios.
  • package.json: Fixed test glob to include root-level test files (test/*.test.mjs).

Behavior

// Before: throws Error
throw new Error(`No meeting found for ${group}...`);

// After: returns null, caller handles gracefully
if (!meetingDate) {
  console.log(`No meeting found for ${group}...`);
  process.exit(0);
}
Original prompt

This section details on the original issue you should resolve

<issue_title>Don't fail on no meeting found</issue_title>
<issue_description>When no meeting is found, it doesn't make sense (IMO) to throw an error. Rather, a 0 exit may make more sense.</issue_description>

Comments on the Issue (you are @copilot in this section)

@ovflowd +1

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits November 3, 2025 17:18
Co-authored-by: avivkeller <38299977+avivkeller@users.noreply.github.com>
Co-authored-by: avivkeller <38299977+avivkeller@users.noreply.github.com>
Copilot AI changed the title [WIP] Don't fail on no meeting found Exit gracefully when no meeting found instead of throwing error Nov 3, 2025
Copilot AI requested a review from avivkeller November 3, 2025 17:25
@avivkeller
avivkeller marked this pull request as ready for review November 3, 2025 17:26
Copilot AI review requested due to automatic review settings November 3, 2025 17:26

Copilot AI left a comment

Copy link
Copy Markdown

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 refactors error handling in the calendar module by converting findNextMeetingDate to return null instead of throwing an error when no meeting is found. The change introduces proper test coverage and moves error handling responsibility to the caller.

  • Refactored findNextMeetingDate to return null instead of throwing an error when no meeting is found
  • Added comprehensive unit tests for the findNextMeetingDate function
  • Updated test scripts in package.json to use Node.js built-in test runner discovery

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
test/calendar.test.mjs New test file with comprehensive test coverage for findNextMeetingDate function, including edge cases for null returns
src/calendar.mjs Exported getWeekBounds function and changed findNextMeetingDate to return null instead of throwing an error
package.json Simplified test scripts to use Node.js automatic test discovery instead of explicit glob patterns
create-node-meeting-artifacts.mjs Added null check after calling findNextMeetingDate to gracefully handle cases where no meeting is found

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@ovflowd ovflowd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SGTM!

@ovflowd
ovflowd merged commit 71093cb into main Nov 4, 2025
11 checks passed
@ovflowd
ovflowd deleted the copilot/fix-9950313-108046388-d06d2156-c4d2-4244-a7c5-102f7480459d branch November 4, 2025 12:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Don't fail on no meeting found

4 participants