diff --git a/pyscript.core/esm/index.js b/pyscript.core/esm/index.js index 2deb1d05..15276818 100644 --- a/pyscript.core/esm/index.js +++ b/pyscript.core/esm/index.js @@ -13,8 +13,18 @@ const RUNTIME_SELECTOR = selectors.join(","); // ensure both runtime and its queue are awaited then returns the runtime const awaitRuntime = async (key) => { - const { runtime, queue } = runtimes.get(key); - return (await all([runtime, queue]))[0]; + if (runtimes.has(key)) { + const { runtime, queue } = runtimes.get(key); + return (await all([runtime, queue]))[0]; + } + + const available = runtimes.size + ? `Available runtimes are: ${[...runtimes.keys()] + .map((r) => `"${r}"`) + .join(", ")}.` + : `There are no runtimes in this page.`; + + throw new Error(`The runtime "${key}" was not found. ${available}`); }; defineProperty(globalThis, "pyscript", { diff --git a/pyscript.core/package.json b/pyscript.core/package.json index 5a49fc0c..bc5e57a2 100644 --- a/pyscript.core/package.json +++ b/pyscript.core/package.json @@ -50,6 +50,6 @@ "coincident": "^0.2.3" }, "worker": { - "blob": "sha256-T0DDfoQde+3gciIoHqPGP2SgMQpbY/nAMjfd1cg8jyA=" + "blob": "sha256-XIl723wj4b0gyB5IGnLem05DRvl5bzkeMahwAmQFMrM=" } }