Skip to content

Commit

Permalink
Add error checking
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanaobrien committed Jan 10, 2025
1 parent a3079c6 commit 284aa05
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions emscripten/static/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
{
Expand Down Expand Up @@ -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"))
Expand Down

0 comments on commit 284aa05

Please sign in to comment.