diff options
author | Andreas Kling <kling@serenityos.org> | 2020-03-24 22:03:50 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-03-24 22:21:58 +0100 |
commit | faddf3a1db6d9c8bb4106eb2259f91fe8e58b817 (patch) | |
tree | ad93acf4f78d132e27259fc4ef5109e3266f9efe /Base/home/anon/js | |
parent | db024a9cb147731cfb14ef60a862a3e392eedc9b (diff) | |
download | serenity-faddf3a1db6d9c8bb4106eb2259f91fe8e58b817.zip |
LibJS: Implement "throw"
You can now throw an expression to the nearest catcher! :^)
To support throwing arbitrary values, I added an Exception class that
sits as a wrapper around whatever is thrown. In the future it will be
a logical place to store a call stack.
Diffstat (limited to 'Base/home/anon/js')
-rw-r--r-- | Base/home/anon/js/throw.js | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Base/home/anon/js/throw.js b/Base/home/anon/js/throw.js new file mode 100644 index 0000000000..67c891f571 --- /dev/null +++ b/Base/home/anon/js/throw.js @@ -0,0 +1,5 @@ +try { + throw 123; +} catch (e) { + console.log(e); +} |