|
@@ -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
|