mirror of
https://github.com/gchq/CyberChef
synced 2025-12-10 21:33:36 +00:00
Add OperationError error type and use for errors to be printed to the output panel
This commit is contained in:
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;
|
||||
Reference in New Issue
Block a user