Fix #1514 - Provide a better feedback on HTML typos (#1515)

This commit is contained in:
Andrea Giammarchi
2023-06-08 13:49:49 +02:00
committed by GitHub
parent af72e232c3
commit 7d3b792a79
2 changed files with 13 additions and 3 deletions

View File

@@ -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", {

View File

@@ -50,6 +50,6 @@
"coincident": "^0.2.3"
},
"worker": {
"blob": "sha256-T0DDfoQde+3gciIoHqPGP2SgMQpbY/nAMjfd1cg8jyA="
"blob": "sha256-XIl723wj4b0gyB5IGnLem05DRvl5bzkeMahwAmQFMrM="
}
}