Skip to content

Commit f70fb2f

Browse files
ideclaude
andcommitted
Report the bundle path when the Fantom tester's JS bundle fails to load
`TesterAppDelegate::loadScript` ignored the result of `ReactHost::loadScript`. When the bundle could not be read, the tester went on to look up `$$RunTests$$` in a runtime that had evaluated nothing, and aborted with "JSError: Value is undefined, expected an Object", which says nothing about the bundle. Throw a `std::runtime_error` that names the bundle path when loading fails. The tester still aborts, and its last line now states the cause. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
1 parent 94aee19 commit f70fb2f

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

‎private/react-native-fantom/tester/src/TesterAppDelegate.cpp‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
#include <react/utils/ContextContainer.h>
3535
#include <react/utils/RunLoopObserverManager.h>
3636
#include <iostream>
37+
#include <stdexcept>
3738
#include <string>
3839
#include <vector>
3940

@@ -169,7 +170,9 @@ void TesterAppDelegate::loadScript(
169170
const std::string& bundlePath,
170171
const std::string& sourcePath) {
171172
LOG(INFO) << "Loading script: " << bundlePath << " source " << sourcePath;
172-
reactHost_->loadScript(bundlePath, sourcePath);
173+
if (!reactHost_->loadScript(bundlePath, sourcePath)) {
174+
throw std::runtime_error("Failed to load the JS bundle at " + bundlePath);
175+
}
173176

174177
reactHost_->runOnRuntimeScheduler(
175178
[this](jsi::Runtime& runtime) { runtime_ = &runtime; });

0 commit comments

Comments
 (0)