fix(core): dev-mode warnings for silently swallowed callback errors#195
fix(core): dev-mode warnings for silently swallowed callback errors#195RtlZeroMemory merged 2 commits intomainfrom
Conversation
Effect cleanups, dropdown/overlay callbacks, and widget event handlers that throw are caught to preserve routing determinism, but the errors were completely invisible. Now emits console.warn in dev mode so developers can see when their callbacks throw. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughThis PR adds development-mode diagnostic utilities ( Changes
Possibly related PRs
Poem
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cc14312dd1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Actionable comments posted: 5
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/core/src/app/widgetRenderer.ts`:
- Around line 418-420: The catch block formatting fails CI; extract the error
message into a short local variable and call warnDev with that variable to make
the line shorter and prettier. Specifically, inside the catch for the widget
renderer replace the long inline ternary with e.g. const msg = e instanceof
Error ? e.message : String(e); then call if (DEV_MODE) warnDev(`[rezi] widget
callback threw: ${msg}`); and finally return false; — update the catch around
the widget renderer callback (references: DEV_MODE, warnDev) to follow this
pattern so formatting checks pass.
In `@packages/core/src/app/widgetRenderer/mouseRouting.ts`:
- Around line 359-361: Reformat the catch warning to avoid the CI formatting
error by extracting the error message into a temporary constant and then passing
a simple template string to warnDev; e.g., inside the catch block for onSelect,
compute const errMsg = e instanceof Error ? e.message : String(e) and then call
warnDev(`[rezi] onSelect callback threw: ${errMsg}`) so the line is shorter and
clearer.
In `@packages/core/src/runtime/instances.ts`:
- Around line 390-391: Replace the template literal passed to warnDev with a
plain string literal to satisfy the lint rule; in the branch where you log the
stale-closure warning (the call to warnDev inside the setState handling when
instance generation changed), change the argument from a backtick string to a
double- or single-quoted string (e.g., "[rezi] setState called from stale
closure (instance generation changed)").
In `@packages/core/src/runtime/router/dropdown.ts`:
- Around line 95-97: Reformat the catch block handling onSelect so it complies
with the project's formatter: replace the single long line with a properly
wrapped block that calls warnDev(...) across lines (e.g., compute the message or
the error string on its own line and then pass a template string to warnDev),
keeping the existing conditional extraction of the message (e instanceof Error ?
e.message : String(e)) and the original text `[rezi] onSelect callback threw:`;
target the catch block around the onSelect invocation where warnDev is called.
In `@packages/core/src/widgets/pagination.ts`:
- Around line 52-54: Replace the template literal warnDev call in the catch
block with a comma-separated call so the logger receives the static message and
the error value separately; update the warnDev invocation in
packages/core/src/widgets/pagination.ts (the catch around decodeURIComponent) to
use warnDev('[rezi] pagination decodeURIComponent failed:', e instanceof Error ?
e.message : String(e)) and keep the subsequent return null.
ℹ️ Review info
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (7)
packages/core/src/app/widgetRenderer.tspackages/core/src/app/widgetRenderer/mouseRouting.tspackages/core/src/app/widgetRenderer/overlayShortcuts.tspackages/core/src/runtime/instances.tspackages/core/src/runtime/router/dropdown.tspackages/core/src/widgets/codeEditorSyntax.tspackages/core/src/widgets/pagination.ts
Summary
warnDev()calls to all silent catch blocks across dropdown routing, overlay shortcuts, mouse routing, effect cleanups, and widget callbacksconsole.warnin dev modeNODE_ENV=productiondisables all warnings)Files changed
runtime/router/dropdown.ts— 3 catch blockswidgetRenderer/overlayShortcuts.ts— 4 catch blockswidgetRenderer/mouseRouting.ts— 5 catch blocksruntime/instances.ts— effect cleanup + stale closure warningswidgets/codeEditorSyntax.ts— custom tokenizer errorwidgets/pagination.ts— decodeURIComponent errorapp/widgetRenderer.ts— generic callback wrapperSummary by CodeRabbit
New Features
Bug Fixes