mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-22 07:46:16 -04:00
Add OperationError error type and use for errors to be printed to the output panel
This commit is contained in:
parent
a8aa1bc5e8
commit
cc20ad9567
10 changed files with 82 additions and 69 deletions
20
src/core/errors/OperationError.mjs
Normal file
20
src/core/errors/OperationError.mjs
Normal file
|
@ -0,0 +1,20 @@
|
|||
/**
|
||||
* Create custom error type for handling operation input errors.
|
||||
* i.e. where the operation can handle the error and print a
|
||||
* message to the screen.
|
||||
*/
|
||||
class OperationError extends Error {
|
||||
/**
|
||||
* Standard error constructor. Adds no new behaviour.
|
||||
* @param args standard error args
|
||||
*/
|
||||
constructor(...args) {
|
||||
super(...args);
|
||||
|
||||
if (Error.captureStackTrace) {
|
||||
Error.captureStackTrace(this, OperationError);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default OperationError;
|
Loading…
Add table
Add a link
Reference in a new issue