fix: handle expired scheduled event links & fix test suite setup #73

Open
beanie wants to merge 2 commits from beanie/out-of-your-element:bugfix/handle-expired-events into main
First-time contributor

This PR addresses a bridge crash discovered while backfilling old channels, alongside a wee QoL fix for the test suite.

  • Expired Events (d2m): Wraps Discord scheduled event/invite link lookups in a try-catch block. If a link is expired (404 or Discord error 10006), the bridge now posts a fallback m.notice rather than throwing an error and halting message conversion.
  • Test Suite Setup: Updates test.js to initialize the mock registration object using getTemplateRegistration() preventing test runner crashes when running without a local registration.yaml file.
This PR addresses a bridge crash discovered while backfilling old channels, alongside a wee QoL fix for the test suite. * **Expired Events (`d2m`):** Wraps Discord scheduled event/invite link lookups in a try-catch block. If a link is expired (404 or Discord error 10006), the bridge now posts a fallback `m.notice` rather than throwing an error and halting message conversion. * **Test Suite Setup:** Updates `test.js` to initialize the mock registration object using `getTemplateRegistration()` preventing test runner crashes when running without a local `registration.yaml` file.
beanie added 2 commits 2026-03-02 02:31:13 +00:00
Wrap the scheduled event lookup in a try-catch block to prevent the
bridge from crashing when it encounters expired or invalid links.
When a 404 or Discord error code 10006 is caught, the bot now
generates a fallback "m.notice" event to inform Matrix users that
the event link has expired.
Running the test suite without a local `registration.yaml` previously
caused a TypeError because the `reg` export defaulted to null. This
injects a base template using `getTemplateRegistration` before applying
test-specific overrides.
beanie force-pushed bugfix/handle-expired-events from 54dad027e6 to 6553946b88 2026-03-02 02:39:35 +00:00 Compare
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u bugfix/handle-expired-events:beanie-bugfix/handle-expired-events
git checkout beanie-bugfix/handle-expired-events

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git checkout main
git merge --no-ff beanie-bugfix/handle-expired-events
git checkout beanie-bugfix/handle-expired-events
git rebase main
git checkout main
git merge --ff-only beanie-bugfix/handle-expired-events
git checkout beanie-bugfix/handle-expired-events
git rebase main
git checkout main
git merge --no-ff beanie-bugfix/handle-expired-events
git checkout main
git merge --squash beanie-bugfix/handle-expired-events
git checkout main
git merge --ff-only beanie-bugfix/handle-expired-events
git checkout main
git merge beanie-bugfix/handle-expired-events
git push origin main
Sign in to join this conversation.
No description provided.