From a737b21aa8a7db9b9994d9df0cac997792e56652 Mon Sep 17 00:00:00 2001 From: Naviary2 Date: Fri, 13 Dec 2024 23:20:08 -0700 Subject: [PATCH] Throw errors instead of logging errors --- src/client/scripts/esm/game/rendering/movement.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/client/scripts/esm/game/rendering/movement.js b/src/client/scripts/esm/game/rendering/movement.js index c1f7fe355..80f3a5b51 100644 --- a/src/client/scripts/esm/game/rendering/movement.js +++ b/src/client/scripts/esm/game/rendering/movement.js @@ -62,8 +62,8 @@ function getBoardPos() { } function setBoardPos(newPos) { - if (!Array.isArray(newPos)) return console.error(`New position must be an array! ${newPos}`); - if (isNaN(newPos[0]) || isNaN(newPos[1])) return console.error(`Cannot set position to ${newPos}!`); + if (!Array.isArray(newPos)) throw new Error(`New position must be an array! ${newPos}`); + if (isNaN(newPos[0]) || isNaN(newPos[1])) throw new Error(`Cannot set position to ${newPos}!`); boardPos = newPos; frametracker.onVisualChange(); } @@ -74,11 +74,8 @@ function getBoardScale() { } function setBoardScale(newScale) { - if (isNaN(newScale)) return console.error(`Cannot set scale to ${newScale}!`); - if (newScale <= 0) { - console.error(`Cannot set scale to ${newScale}!!`); - return console.trace(); - } + if (isNaN(newScale)) throw new Error(`Cannot set scale to ${newScale}!`); + if (newScale <= 0) throw new Error(`Cannot set scale to ${newScale}!`); boardScale = newScale;