mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-20 06:55:08 -04:00
Throw ExcludedOperationError when excluded operation is called from API
This commit is contained in:
parent
7c9ebafd00
commit
96d5930f05
6 changed files with 143 additions and 8 deletions
|
@ -11,6 +11,7 @@ import SyncDish from "./SyncDish";
|
|||
import Recipe from "./Recipe";
|
||||
import OperationConfig from "./config/OperationConfig.json";
|
||||
import { sanitise } from "./apiUtils";
|
||||
import ExludedOperationError from "../core/errors/ExcludedOperationError";
|
||||
|
||||
|
||||
/**
|
||||
|
@ -246,3 +247,19 @@ export function bake(operations){
|
|||
return recipe.execute(dish);
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Explain that the given operation is not included in the Node.js version.
|
||||
* @param {String} name - name of operation
|
||||
*/
|
||||
export function explainExludedFunction(name) {
|
||||
/**
|
||||
* Throw new error type with useful message.
|
||||
*/
|
||||
const func = () => {
|
||||
throw new ExludedOperationError(`Sorry, the ${name} operation is not available in the Node.js version of CyberChef.`);
|
||||
};
|
||||
// Add opName prop so Recipe can handle it, just like wrap does.
|
||||
func.opName = name;
|
||||
return func;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue