1
0
mirror of https://github.com/sehugg/8bitworkshop.git synced 2024-12-21 21:29:17 +00:00

fixed error when platform is invalid

This commit is contained in:
Steven Hugg 2021-08-02 14:04:56 -05:00
parent 1daa080e70
commit e00819da59
3 changed files with 9 additions and 10 deletions

View File

@ -3,6 +3,7 @@ TSC=./node_modules/typescript/bin/tsc --build
TMP=./tmp/dist
buildtsc:
npm run esbuild-clean
$(TSC) tsconfig.json
npm run esbuild
@ -25,7 +26,7 @@ prepare: buildtsc
cd jsnes && npm i
npm run mkdoc
distro:
distro: buildtsc
rm -fr $(TMP) && mkdir -p $(TMP)
git archive HEAD | tar x -C $(TMP)
cp -rp gen $(TMP)

View File

@ -168,9 +168,9 @@ async function startPlatform(qs) {
async function loadPlatform(qs) {
if (qs.data) qs = qs.data;
platform_id = qs['p'];
if (!platform_id) throw('No platform variable!');
var module = await importPlatform(getRootBasePlatform(platform_id));
if (!platform_id) throw new Error('No platform variable!');
try {
var module = await importPlatform(getRootBasePlatform(platform_id));
console.log("starting platform", platform_id); // loaded required <platform_id>.js file
await startPlatform(qs);
} catch (e) {

View File

@ -2355,18 +2355,16 @@ export async function startUI() {
}
async function loadAndStartPlatform() {
try {
var module = await importPlatform(getRootBasePlatform(platform_id));
try {
console.log("starting platform", platform_id); // loaded required <platform_id>.js file
try {
await startPlatform();
document.title = document.title + " [" + platform_id + "] - " + (repo_id?('['+repo_id+'] - '):'') + current_project.mainPath;
} finally {
revealTopBar();
}
} catch (e) {
console.log(e);
alertError('Platform "' + platform_id + '" failed to load.');
} finally {
revealTopBar();
}
}