Skip to content

Commit

Permalink
Throw errors instead of logging errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Naviary2 committed Dec 14, 2024
1 parent e4dbf41 commit a737b21
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/client/scripts/esm/game/rendering/movement.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand All @@ -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;

Expand Down

0 comments on commit a737b21

Please sign in to comment.