diff --git a/src/core/lib/IP.mjs b/src/core/lib/IP.mjs index 63816d82..c97f87ab 100644 --- a/src/core/lib/IP.mjs +++ b/src/core/lib/IP.mjs @@ -26,7 +26,7 @@ export function ipv4CidrRange(cidr, includeNetworkInfo, enumerateAddresses, allo let output = ""; if (cidrRange < 0 || cidrRange > 31) { - return "IPv4 CIDR must be less than 32"; + throw new OperationError("IPv4 CIDR must be less than 32"); } const mask = ~(0xFFFFFFFF >>> cidrRange), @@ -211,7 +211,7 @@ export function ipv4ListedRange(match, includeNetworkInfo, enumerateAddresses, a const network = strToIpv4(ipv4CidrList[i].split("/")[0]); const cidrRange = parseInt(ipv4CidrList[i].split("/")[1], 10); if (cidrRange < 0 || cidrRange > 31) { - return "IPv4 CIDR must be less than 32"; + throw new OperationError("IPv4 CIDR must be less than 32"); } const mask = ~(0xFFFFFFFF >>> cidrRange), cidrIp1 = network & mask, diff --git a/src/core/operations/RegularExpression.mjs b/src/core/operations/RegularExpression.mjs index 5327870b..5239e55f 100644 --- a/src/core/operations/RegularExpression.mjs +++ b/src/core/operations/RegularExpression.mjs @@ -163,7 +163,7 @@ class RegularExpression extends Operation { case "List matches with capture groups": return Utils.escapeHtml(regexList(input, regex, displayTotal, true, true)); default: - return "Error: Invalid output format"; + throw new OperationError("Error: Invalid output format"); } } catch (err) { throw new OperationError("Invalid regex. Details: " + err.message);