Merge branch 'esm' of github.com:gchq/CyberChef into node-lib
This commit is contained in:
commit
e50758f0a6
@ -7,8 +7,8 @@
|
|||||||
// import Operation from "./Operation.js";
|
// import Operation from "./Operation.js";
|
||||||
import OpModules from "./config/modules/OpModules";
|
import OpModules from "./config/modules/OpModules";
|
||||||
import OperationConfig from "./config/OperationConfig.json";
|
import OperationConfig from "./config/OperationConfig.json";
|
||||||
import log from "loglevel";
|
|
||||||
import OperationError from "./errors/OperationError";
|
import OperationError from "./errors/OperationError";
|
||||||
|
import log from "loglevel";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Recipe controls a list of Operations and the Dish they operate on.
|
* The Recipe controls a list of Operations and the Dish they operate on.
|
||||||
@ -176,7 +176,7 @@ class Recipe {
|
|||||||
dish.set(output, op.outputType);
|
dish.set(output, op.outputType);
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
// print expected errors in output pane
|
// Return expected errors as output
|
||||||
if (err instanceof OperationError) {
|
if (err instanceof OperationError) {
|
||||||
dish.set(err.message, "string");
|
dish.set(err.message, "string");
|
||||||
return i;
|
return i;
|
||||||
@ -185,11 +185,10 @@ class Recipe {
|
|||||||
|
|
||||||
e.progress = i;
|
e.progress = i;
|
||||||
if (e.fileName) {
|
if (e.fileName) {
|
||||||
e.displayStr = op.name + " - " + e.name + " in " +
|
e.displayStr = `${op.name} - ${e.name} in ${e.fileName} on line ` +
|
||||||
e.fileName + " on line " + e.lineNumber +
|
`${e.lineNumber}.<br><br>Message: ${e.displayStr || e.message}`;
|
||||||
".<br><br>Message: " + (e.displayStr || e.message);
|
|
||||||
} else {
|
} else {
|
||||||
e.displayStr = op.name + " - " + (e.displayStr || e.message);
|
e.displayStr = `${op.name} - ${e.displayStr || e.message}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
throw e;
|
throw e;
|
||||||
|
@ -1,12 +1,16 @@
|
|||||||
/**
|
/**
|
||||||
* Create custom error type for handling operation input errors.
|
* Custom error type for handling operation input errors.
|
||||||
* i.e. where the operation can handle the error and print a
|
* i.e. where the operation can handle the error and print a message to the screen.
|
||||||
* message to the screen.
|
*
|
||||||
|
* @author d98762625 [d98762625@gmail.com]
|
||||||
|
* @copyright Crown Copyright 2018
|
||||||
|
* @license Apache-2.0
|
||||||
*/
|
*/
|
||||||
class OperationError extends Error {
|
class OperationError extends Error {
|
||||||
/**
|
/**
|
||||||
* Standard error constructor. Adds no new behaviour.
|
* Standard error constructor. Adds no new behaviour.
|
||||||
* @param args standard error args
|
*
|
||||||
|
* @param args - Standard error args
|
||||||
*/
|
*/
|
||||||
constructor(...args) {
|
constructor(...args) {
|
||||||
super(...args);
|
super(...args);
|
||||||
|
Loading…
Reference in New Issue
Block a user