From 284aa05d89b87b4406efdd0d20f2b1e96678191c Mon Sep 17 00:00:00 2001 From: Ethan O'Brien Date: Fri, 10 Jan 2025 12:12:31 -0600 Subject: [PATCH] Add error checking --- emscripten/static/index.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/emscripten/static/index.js b/emscripten/static/index.js index 30dae52ababe..e69595541e7a 100644 --- a/emscripten/static/index.js +++ b/emscripten/static/index.js @@ -13,6 +13,10 @@ { document.getElementById("loadingWebassembly").innerText = "Error! SharedArrayBuffer is not defined. This page required the CORP and COEP response headers."; } + if (!window.WebAssembly) + { + document.getElementById("loadingWebassembly").innerText = "Error! This page requires WebAssembly. Please upgrade your browser or enable WebAssembly support."; + } window.Module = await window.OPENRCT2_WEB( { @@ -160,8 +164,12 @@ async function updateAssets() { } catch(e) { console.log("No asset version found"); }; - - const assets_version = Module.ccall("GetVersion", "string"); + let assetsVersion = "DEBUG"; + try { + assetsVersion = Module.ccall("GetVersion", "string"); + } catch(e) { + console.warn("Could not call 'GetVersion'! Is it added to EXPORTED_FUNCTIONS? Is ccall added to EXPORTED_RUNTIME_METHODS?"); + }; //Always pull assets on a debug build if (currentVersion !== assets_version || assets_version.includes("DEBUG"))