From 13924fdb1b75325b9b6116accb800bd9f567f2c1 Mon Sep 17 00:00:00 2001 From: Oliver Medhurst Date: Mon, 3 Jun 2024 11:01:43 +0100 Subject: [PATCH] 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 --- ext/console/01_console.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ext/console/01_console.js b/ext/console/01_console.js index 32d8d653c7..785d7ffe6c 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);