mirror of
https://github.com/gchq/CyberChef.git
synced 2024-11-02 14:11:02 +01:00
ESM: Changed thrown errors to OperationErrors
This commit is contained in:
parent
cefe3fc542
commit
0d1e5311dc
@ -10,6 +10,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
import OperationError from "../errors/OperationError";
|
||||
import kbpgp from "kbpgp";
|
||||
import promisifyDefault from "es6-promisify";
|
||||
const promisify = promisifyDefault.promisify;
|
||||
@ -86,12 +87,12 @@ export async function importPrivateKey(privateKey, passphrase) {
|
||||
passphrase
|
||||
});
|
||||
} else {
|
||||
throw "Did not provide passphrase with locked private key.";
|
||||
throw new OperationError("Did not provide passphrase with locked private key.");
|
||||
}
|
||||
}
|
||||
return key;
|
||||
} catch (err) {
|
||||
throw `Could not import private key: ${err}`;
|
||||
throw new OperationError(`Could not import private key: ${err}`);
|
||||
}
|
||||
}
|
||||
|
||||
@ -111,6 +112,6 @@ export async function importPublicKey (publicKey) {
|
||||
});
|
||||
return key;
|
||||
} catch (err) {
|
||||
throw `Could not import public key: ${err}`;
|
||||
throw new OperationError(`Could not import public key: ${err}`);
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
*/
|
||||
|
||||
import Operation from "../Operation";
|
||||
import OperationError from "../errors/OperationError";
|
||||
import bcrypt from "bcryptjs";
|
||||
|
||||
/**
|
||||
@ -38,7 +39,7 @@ Salt: ${bcrypt.getSalt(input)}
|
||||
Password hash: ${input.split(bcrypt.getSalt(input))[1]}
|
||||
Full hash: ${input}`;
|
||||
} catch (err) {
|
||||
return "Error: " + err.toString();
|
||||
throw new OperationError("Error: " + err.toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user