1
0
mirror of https://github.com/sehugg/8bitworkshop.git synced 2024-12-22 12:30:01 +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 TMP=./tmp/dist
buildtsc: buildtsc:
npm run esbuild-clean
$(TSC) tsconfig.json $(TSC) tsconfig.json
npm run esbuild npm run esbuild
@ -25,7 +26,7 @@ prepare: buildtsc
cd jsnes && npm i cd jsnes && npm i
npm run mkdoc npm run mkdoc
distro: distro: buildtsc
rm -fr $(TMP) && mkdir -p $(TMP) rm -fr $(TMP) && mkdir -p $(TMP)
git archive HEAD | tar x -C $(TMP) git archive HEAD | tar x -C $(TMP)
cp -rp gen $(TMP) cp -rp gen $(TMP)

View File

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

View File

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