mirror of
https://github.com/gchq/CyberChef
synced 2025-12-20 02:03:28 +00:00
Changed all error returns to OperationErrors
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user