Report a catch that only discards its error - #1210
Merged
Merged
Conversation
A log line, including console.error, still counts as handling the exception. Co-authored-by: Cursor <cursoragent@cursor.com> Change-Id: I9440b5b3f39e69c99b032041d0f298b03c5f29f3
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_8c402c7d-29de-4232-a8b4-0c6e4cd1f64e) |
Contributor
|
Queued — the merge queue status continues in this comment ↓. |
Owner
Author
Owner
Author
|
@Mergifyio queue |
Contributor
Merge Queue Status
This pull request spent 44 minutes 43 seconds in the queue, including 44 minutes 20 seconds running CI. Required conditions to merge
|
6 tasks
This file contains hidden or 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
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.
Summary
A catch that only discards its error is the same silence as an empty catch.
The failure hook now reports that shape.
A catch that logs the error stays quiet.
Review Claim
The failure hook reports a catch that only discards its error, and stays quiet when the catch logs the error.
Review Lane
behavior
Review Unit
engine-runtime
Safety Invariant
The hook stays advisory. A catch that logs the exception is not reported.
Slice Rationale
This slice is only the hook. The skill text is the next pull request.
Non-goals
No change to the principle skill text.
Test Plan
Test Plan
python3 -m unittest discover -s engine/hooks/explicit-failures/tests -qpython3 scripts/ci/check_hook_test_coverage.py engine/hooks/explicit-failuresRevert Plan
Revert Plan
git revert 45754a29python3 -m unittest discover -s engine/hooks/explicit-failures/tests -q.Note
Low Risk
Advisory-only hook behavior change with targeted regex and tests; no auth, data, or runtime execution impact.
Overview
Extends the explicit-failures PreToolUse scanner so JS/TS
catchbodies made only ofvoid <err>are reported as silent failures, alongside empty or bare-exit catches.console.erroris now treated like other explicit-handling tokens (log,raise, etc.), so catches that log (includingvoid console.error(...)) stay suppressed. README anddetect.pydocs match the new rules.Unit tests cover the new hit message and the no-report paths for
console.errorandvoid console.error.Reviewed by Cursor Bugbot for commit 45754a2. Bugbot is set up for automated code reviews on this repo. Configure here.