Skip to content

Commit decfb98

Browse files
committed
feat: error handling improvements and cleanup debug logs
1 parent 41a98f9 commit decfb98

File tree

3 files changed

+209
-412
lines changed

3 files changed

+209
-412
lines changed

NativeScript/NativeScript.mm

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ - (void)runMainApplication {
4747
// In debug mode, if JavaScript errors occurred, keep the app alive indefinitely
4848
// This prevents iOS from terminating the app and allows hot-reload to work
4949
if (RuntimeConfig.IsDebug && jsErrorOccurred) {
50-
NSLog(@"🔧 Debug mode - JavaScript errors detected, hijacking main thread to keep app alive");
51-
NSLog(@"🔧 Debug mode - Entering infinite run loop to prevent app termination");
52-
NSLog(@"🔧 Debug mode - Hot-reload and error modal should work normally");
50+
// NSLog(@"🔧 Debug mode - JavaScript errors detected, hijacking main thread to keep app alive");
51+
// NSLog(@"🔧 Debug mode - Entering infinite run loop to prevent app termination");
52+
// NSLog(@"🔧 Debug mode - Hot-reload and error modal should work normally");
5353

5454
// Main thread hijack: Enter infinite run loop to keep app alive
5555
while (true) {

NativeScript/runtime/ModuleInternal.mm

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -505,8 +505,8 @@ bool IsESModule(const std::string& path) {
505505
// Check if script loading failed (debug mode graceful returns)
506506
if (scriptValue.IsEmpty()) {
507507
if (RuntimeConfig.IsDebug) {
508-
NSLog(@"Debug mode - Script loading returned empty value, returning gracefully: %s",
509-
modulePath.c_str());
508+
// NSLog(@"Debug mode - Script loading returned empty value, returning gracefully: %s",
509+
// modulePath.c_str());
510510
return Local<Object>();
511511
} else {
512512
throw NativeScriptException(isolate, "Script loading failed for " + modulePath);
@@ -994,16 +994,10 @@ ScriptOrigin origin(isolate, urlString, 0, 0, false, -1, Local<Value>(), false,
994994
tns::LogError(isolate, promiseTc);
995995
}
996996

997-
NSLog(@"***** End stack trace - continuing execution *****");
998-
999-
NSLog(@"🔥 📦 MODULE MODAL: About to call ShowErrorModal from ModuleInternal!");
1000-
NSLog(@"🔥 📦 ModuleInternal title: %s", errorTitle.c_str());
1001-
NSLog(@"🔥 📦 ModuleInternal message: %s", errorMessage.c_str());
1002-
NSLog(@"🔥 📦 ModuleInternal calling ShowErrorModal NOW!");
997+
NSLog(@"***** End stack trace - Fix to continue *****");
1003998

1004999
NativeScriptException::ShowErrorModal(errorTitle, errorMessage, stackTrace);
10051000

1006-
NSLog(@"Debug mode - ES module promise rejected, returning gracefully");
10071001
// In debug mode, don't throw any exceptions - just return empty value
10081002
return Local<Value>();
10091003
} else {

0 commit comments

Comments
 (0)