diff options
author | Andreas Kling <kling@serenityos.org> | 2020-03-24 14:37:39 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-03-24 16:14:10 +0100 |
commit | 343e224aa80c96e46027358a7e03a9ae6ffadd09 (patch) | |
tree | 764c615dda830b2fe32d0cf51a9497a3ea524a15 /Base/home/anon/js | |
parent | c33d4aefc3eb1d91d90c55b4d18e6b972fd8d6eb (diff) | |
download | serenity-343e224aa80c96e46027358a7e03a9ae6ffadd09.zip |
LibJS: Implement basic exception throwing
You can now throw exceptions by calling Interpreter::throw_exception().
Anyone who calls ASTNode::execute() needs to check afterwards if the
Interpreter now has an exception(), and if so, stop what they're doing
and simply return.
When catching an exception, we'll first execute the CatchClause node
if present. After that, we'll execute the finalizer block if present.
This is unlikely to be completely correct, but it's a start! :^)
Diffstat (limited to 'Base/home/anon/js')
-rw-r--r-- | Base/home/anon/js/try.js | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/Base/home/anon/js/try.js b/Base/home/anon/js/try.js index 26e950aa06..7b4f892ca4 100644 --- a/Base/home/anon/js/try.js +++ b/Base/home/anon/js/try.js @@ -4,6 +4,7 @@ try { console.log("not me"); } catch (e) { console.log("catch"); + console.log(e.name); } finally { console.log("finally"); } |