mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-21 15:26:16 -04:00
Changed all error returns to OperationErrors
This commit is contained in:
parent
b3ee251ee3
commit
2e4f5b7070
25 changed files with 88 additions and 35 deletions
|
@ -7,6 +7,7 @@
|
|||
import Operation from "../Operation";
|
||||
import Utils from "../Utils";
|
||||
import {DELIM_OPTIONS} from "../lib/Delim";
|
||||
import OperationError from "../errors/OperationError";
|
||||
|
||||
/**
|
||||
* To Charcode operation
|
||||
|
@ -42,6 +43,8 @@ class ToCharcode extends Operation {
|
|||
* @param {string} input
|
||||
* @param {Object[]} args
|
||||
* @returns {string}
|
||||
*
|
||||
* @throws {OperationError} if base argument out of range
|
||||
*/
|
||||
run(input, args) {
|
||||
const delim = Utils.charRep(args[0] || "Space"),
|
||||
|
@ -51,7 +54,7 @@ class ToCharcode extends Operation {
|
|||
ordinal;
|
||||
|
||||
if (base < 2 || base > 36) {
|
||||
throw "Error: Base argument must be between 2 and 36";
|
||||
throw new OperationError("Error: Base argument must be between 2 and 36");
|
||||
}
|
||||
|
||||
const charcode = Utils.strToCharcode(input);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue