mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 20:11:24 +08:00
refactor(): add better err msg for missing main entry (#7063)
This commit is contained in:
@ -273,16 +273,15 @@ function createRootView(v?: View) {
|
|||||||
let rootView = v;
|
let rootView = v;
|
||||||
if (!rootView) {
|
if (!rootView) {
|
||||||
// try to navigate to the mainEntry (if specified)
|
// try to navigate to the mainEntry (if specified)
|
||||||
if (mainEntry) {
|
if (!mainEntry) {
|
||||||
|
throw new Error("Main entry is missing. App cannot be started. Verify app bootstrap.");
|
||||||
|
} else {
|
||||||
if (createRootFrame.value) {
|
if (createRootFrame.value) {
|
||||||
const frame = rootView = new Frame();
|
const frame = rootView = new Frame();
|
||||||
frame.navigate(mainEntry);
|
frame.navigate(mainEntry);
|
||||||
} else {
|
} else {
|
||||||
rootView = createViewFromEntry(mainEntry);
|
rootView = createViewFromEntry(mainEntry);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
// TODO: Throw an exception?
|
|
||||||
throw new Error("A Frame must be used to navigate to a Page.");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1171,6 +1171,10 @@ class ActivityCallbacksImplementation implements AndroidActivityCallbacks {
|
|||||||
|
|
||||||
if (!rootView) {
|
if (!rootView) {
|
||||||
const mainEntry = application.getMainEntry();
|
const mainEntry = application.getMainEntry();
|
||||||
|
if (!mainEntry) {
|
||||||
|
throw new Error("Main entry is missing. App cannot be started. Verify app bootstrap.");
|
||||||
|
}
|
||||||
|
|
||||||
const intent = activity.getIntent();
|
const intent = activity.getIntent();
|
||||||
|
|
||||||
if (fireLaunchEvent) {
|
if (fireLaunchEvent) {
|
||||||
|
Reference in New Issue
Block a user