mirror of
https://github.com/gchq/CyberChef
synced 2025-12-18 01:03:47 +00:00
Changed all error returns to OperationErrors
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
import Operation from "../Operation";
|
||||
import moment from "moment-timezone";
|
||||
import {DATETIME_FORMATS, FORMAT_EXAMPLES} from "../lib/DateTime";
|
||||
import OperationError from "../errors/OperationError";
|
||||
|
||||
/**
|
||||
* Parse DateTime operation
|
||||
@@ -59,7 +60,7 @@ class ParseDateTime extends Operation {
|
||||
date = moment.tz(input, inputFormat, inputTimezone);
|
||||
if (!date || date.format() === "Invalid date") throw Error;
|
||||
} catch (err) {
|
||||
return "Invalid format.\n\n" + FORMAT_EXAMPLES;
|
||||
throw new OperationError(`Invalid format.\n\n${FORMAT_EXAMPLES}`);
|
||||
}
|
||||
|
||||
output += "Date: " + date.format("dddd Do MMMM YYYY") +
|
||||
|
||||
Reference in New Issue
Block a user