From a3e84741b76c84629ae8ec45bd17d427e0437d07 Mon Sep 17 00:00:00 2001 From: Chris Mayfield Date: Thu, 24 Oct 2024 16:43:04 -0400 Subject: [PATCH] bug fix: praxly doesn't init when url is malformed --- src/ast.js | 3 ++- src/main.js | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/ast.js b/src/ast.js index e16e866..59bb453 100644 --- a/src/ast.js +++ b/src/ast.js @@ -577,7 +577,8 @@ class Praxly_input { try { const result = await consoleInput(); return new Praxly_String(result, this.json); - } catch (e) { + } + catch (error) { throw new PraxlyError("input canceled", this.json.line); } } diff --git a/src/main.js b/src/main.js index 44200a9..982d79c 100644 --- a/src/main.js +++ b/src/main.js @@ -751,7 +751,11 @@ function parseUrlConfiguration() { const pattern = '#code='; if (hash.startsWith(pattern)) { let source = hash.substring(pattern.length); - configuration.code = decodeURIComponent(source); + try { + configuration.code = decodeURIComponent(source); + } catch (error) { + configuration.code = '// Unable to get code from URL\n// '+ error + '\n'; + } } else { configuration.code = null; }