Skip to content

fix: throw JS exception instead of silent warning for disposed native object calls in debug mode#354

Open
NathanWalker wants to merge 1 commit intomainfrom
fix/js-exception
Open

fix: throw JS exception instead of silent warning for disposed native object calls in debug mode#354
NathanWalker wants to merge 1 commit intomainfrom
fix/js-exception

Conversation

@NathanWalker
Copy link
Copy Markdown
Contributor

@NathanWalker NathanWalker commented Apr 3, 2026

  • Replaces silent Log() warnings with proper isolate->ThrowException() calls when
    invoking methods on disposed native objects in debug mode
  • Provides specific, actionable error messages that name the method, class, and selector
  • Still avoids crashing the app in debug mode

Context

The change in #294 (42a5328) prevented crashes during HMR (debug mode only) by replacing tns::Assert with
a Log() warning that silently returned v8::Undefined. While this fixed the crash, it
introduced a regression: errors became undetectable from JS, and undefined values could
silently leak into arrays and other data structures.

This fix takes the middle path — a catchable JS exception that:

  1. Doesn't crash the app (HMR-safe)
  2. Is detectable via try/catch
  3. Prevents silent undefined propagation
  4. Gives developers a clear message about what went wrong

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.

1 participant