diff options
author | Oliver Medhurst <oj@oojmed.com> | 2024-06-03 11:01:43 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-03 12:01:43 +0200 |
commit | 13924fdb1b75325b9b6116accb800bd9f567f2c1 (patch) | |
tree | 5aeaee1cf817129dd57670cf301baf2754df29e1 /ext/console | |
parent | b1f776adef6f0d0caa0b2badf9fb707cf5efa6e7 (diff) |
fix(console): add missing AssertionError to js (#22358)
Previously it did not exist, so `assert` would crash the wrong way if it
failed.
Signed-off-by: CanadaHonk <honk@goose.icu>
Diffstat (limited to 'ext/console')
-rw-r--r-- | ext/console/01_console.js | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/ext/console/01_console.js b/ext/console/01_console.js index 32d8d653c..785d7ffe6 100644 --- a/ext/console/01_console.js +++ b/ext/console/01_console.js @@ -172,6 +172,13 @@ function getStderrNoColor() { return noColorStderr(); } +class AssertionError extends Error { + name = "AssertionError"; + constructor(message) { + super(message); + } +} + function assert(cond, msg = "Assertion failed.") { if (!cond) { throw new AssertionError(msg); |