Quellcode durchsuchen

Replace RangeError with WrongStackSizeError

ApisNecros vor 1 Jahr
Ursprung
Commit
93bba66101
1 geänderte Dateien mit 2 neuen und 2 gelöschten Zeilen
  1. 2 2
      src/codebox.ts

+ 2 - 2
src/codebox.ts

@@ -1,6 +1,6 @@
 import { Stack } from "./stack.js";
 import { InstructionPointer } from "./pointer.js";
-import { EmptyCodeBoxError, FailedToParseCodeBoxError } from "./errors.js";
+import { EmptyCodeBoxError, FailedToParseCodeBoxError, WrongStackSizeError } from "./errors.js";
 import { CodeBoxOptions, OrdinalDirection } from "./types.js";
 import { charToDecimal, deepClone } from "./common.js";
 import { Node } from "typescript";
@@ -570,7 +570,7 @@ export class CodeBox {
         const stackCount = this.stacks[this.currentStackIndex]!.length();
 
         if (spliceCount > stackCount) {
-            throw new RangeError(`Cannot remove ${spliceCount} elements from a stack of only ${stackCount} elements`);
+            throw new WrongStackSizeError(spliceCount, stackCount);
         }
 
         // Need to reverse the popMany call to maintain order of elements