From aca2807fd6a3eab17bd3c43bd9e79050f2b3a829 Mon Sep 17 00:00:00 2001 From: Davor Hrg Date: Thu, 14 Mar 2024 20:53:36 +0100 Subject: [PATCH] catch error --- apps/jscad-web/main.js | 12 ++++++++---- apps/jscad-web/online.editor.md | 3 ++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/apps/jscad-web/main.js b/apps/jscad-web/main.js index 7fffe64..9417416 100644 --- a/apps/jscad-web/main.js +++ b/apps/jscad-web/main.js @@ -207,10 +207,14 @@ function trackJobs(jobs) { const runScript = async ({ script, url = './jscad.model.js', base = currentBase, root }) => { currentBase = base loadDefault = false // don't load default model if something else was loaded - const result = await workerApi.runScript({ script, url, base, root, smooth: viewState.smoothRender }) - genParams({ target: byId('paramsDiv'), params: result.def || {}, callback: paramChangeCallback }) - lastRunParams = result.params - handlers.entities(result) + try{ + const result = await workerApi.runScript({ script, url, base, root, smooth: viewState.smoothRender }) + genParams({ target: byId('paramsDiv'), params: result.def || {}, callback: paramChangeCallback }) + lastRunParams = result.params + handlers.entities(result) + }catch(err){ + setError(err) + } } const bundles = { diff --git a/apps/jscad-web/online.editor.md b/apps/jscad-web/online.editor.md index 8ca970b..f3e6b7c 100644 --- a/apps/jscad-web/online.editor.md +++ b/apps/jscad-web/online.editor.md @@ -14,6 +14,7 @@ Any text or code editor will work for this (vi, vim, neovim, notepad++, VSCodium - edit the file, save the changes, jscad.app will automatically re-run the script A chromium based browser is required, as other browser do not allow JS to see changes to the file. +Firefox plays dumb and will indefinitely give the initial file version, even after it changes on your drive. ## Enthusiast: a multifile project @@ -42,7 +43,7 @@ I personally prefer to use VSCode and drag/drop my file onto jscad.app to see it any editor drag and dropping file to openjscad or jscad.app will cause it to be given to the browser with permission to read it. You must use Chrome for jscad to be able to check few times a second to see if it changed -Only Chrome can get change info and read new content ... Firefox plays dumb and will indefinitely give the initial file version, even after it chanes on your drive +Only Chrome can get change info and read new content ...