Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 21 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/core/operations/CSSSelector.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class CSSSelector extends Operation {
case node.TEXT_NODE: return node.wholeText;
case node.COMMENT_NODE: return node.data;
case node.DOCUMENT_NODE: return node.outerHTML;
default: throw new Error("Unknown Node Type: " + node.nodeType);
default: throw new OperationError("Unknown Node Type: " + node.nodeType);
}*/
};

Expand Down
2 changes: 1 addition & 1 deletion src/core/operations/LuhnChecksum.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class LuhnChecksum extends Operation {

// If element is not a valid number in the given radix.
if (isNaN(temp)) {
throw new Error("Character: " + elem + " is not valid in radix " + radix + ".");
throw new OperationError("Character: " + elem + " is not valid in radix " + radix + ".");
}

// If element is in an even position
Expand Down
3 changes: 2 additions & 1 deletion src/core/operations/MOD.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import BigNumber from "bignumber.js";
import Operation from "../Operation.mjs";
import OperationError from "../errors/OperationError.mjs";
import { createNumArray } from "../lib/Arithmetic.mjs";
import { ARITHMETIC_DELIM_OPTIONS } from "../lib/Delim.mjs";

Expand Down Expand Up @@ -48,7 +49,7 @@ class MOD extends Operation {
const delimiter = args[1];

if (modulus.isZero()) {
throw new Error("Modulus cannot be zero");
throw new OperationError("Modulus cannot be zero");
}

const numbers = createNumArray(input, delimiter);
Expand Down
11 changes: 11 additions & 0 deletions tests/operations/tests/LuhnChecksum.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -433,4 +433,15 @@ TestRegister.addTests([
},
],
},
{
name: "Luhn Checksum: Invalid character for radix error",
input: "123G",
expectedOutput: "Character: G is not valid in radix 10.",
recipeConfig: [
{
op: "Luhn Checksum",
args: [10]
},
],
},
]);
3 changes: 1 addition & 2 deletions tests/operations/tests/MOD.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,7 @@ TestRegister.addTests([
{
name: "MOD: Zero modulus error",
input: "15 4 7",
expectedError: true,
expectedOutput: "MOD - Modulus cannot be zero",
expectedOutput: "Modulus cannot be zero",
recipeConfig: [
{
"op": "MOD",
Expand Down