LearnNewsExamplesServices
Frontmatter
id9444
titleClean up redundant `Neo.isDestroyed` catch blocks
stateClosed
labels
enhancementairefactoringcore
assigneestobiu
createdAtMar 11, 2026, 5:42 PM
updatedAtMar 15, 2026, 12:39 PM
githubUrlhttps://github.com/neomjs/neo/issues/9444
authortobiu
commentsCount1
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtMar 11, 2026, 5:53 PM

Clean up redundant Neo.isDestroyed catch blocks

Closed v12.1.0 enhancementairefactoringcore
tobiu
tobiu commented on Mar 11, 2026, 5:42 PM

The framework globally handles unhandled promise rejections for the Neo.isDestroyed symbol (inside src/Neo.mjs).

Because of this built-in global interceptor, individual .catch() blocks on promises (like those returned by this.trap()) that merely check for err !== Neo.isDestroyed and re-throw are redundant and add unnecessary boilerplate to the codebase.

We should clean up the remaining occurrences of this pattern in the src/ directory to simplify the code.

Occurrences found in:

  • src/worker/mixin/RemoteMethodAccess.mjs
  • src/component/Circle.mjs
  • src/component/Helix.mjs
  • src/component/MagicMoveText.mjs
  • src/mixin/DomEvents.mjs
  • src/core/Base.mjs
tobiu added the enhancement label on Mar 11, 2026, 5:42 PM
tobiu added the ai label on Mar 11, 2026, 5:42 PM
tobiu added the refactoring label on Mar 11, 2026, 5:42 PM
tobiu added the core label on Mar 11, 2026, 5:42 PM
tobiu referenced in commit f79713a - "refactor(core): Remove redundant catch blocks for globally handled Neo.isDestroyed exceptions (#9444)" on Mar 11, 2026, 5:52 PM
tobiu
tobiu Mar 11, 2026, 5:52 PM

Input from Gemini 3.1 Pro:

✦ The redundant catch blocks checking for Neo.isDestroyed have been removed from the identified locations:

  • src/worker/mixin/RemoteMethodAccess.mjs
  • src/component/Circle.mjs
  • src/component/Helix.mjs
  • src/mixin/DomEvents.mjs
  • src/core/Base.mjs

(Note: The explicit check in src/component/MagicMoveText.mjs was intentionally left in place because it is not a redundant re-throw; it serves as a critical early exit (return;) before executing a visual retry fallback loop, which we do not want to trigger on a destroyed component).

The codebase is now cleaner, relying on the central unhandledrejection interceptors in src/Neo.mjs to silently swallow Neo.isDestroyed exceptions as designed.

tobiu closed this issue on Mar 11, 2026, 5:53 PM
tobiu assigned to @tobiu on Mar 15, 2026, 12:39 PM