mirror of
https://codeberg.org/PGPainless/sop-java.git
synced 2024-11-26 00:52:07 +01:00
Properly throw CannotDecrypt exception with error message
This commit is contained in:
parent
e75dde1637
commit
c32ef9830b
4 changed files with 13 additions and 0 deletions
|
@ -106,6 +106,9 @@ public class DecryptCmd extends AbstractSopCmd {
|
|||
} catch (SOPGPException.BadData badData) {
|
||||
String errorMsg = getMsg("sop.error.input.stdin_not_a_message");
|
||||
throw new SOPGPException.BadData(errorMsg, badData);
|
||||
} catch (SOPGPException.CannotDecrypt e) {
|
||||
String errorMsg = getMsg("sop.error.runtime.cannot_decrypt_message");
|
||||
throw new SOPGPException.CannotDecrypt(errorMsg, e);
|
||||
} catch (IOException ioException) {
|
||||
throw new RuntimeException(ioException);
|
||||
}
|
||||
|
|
|
@ -64,6 +64,7 @@ sop.error.runtime.key_cannot_sign=Secret key from input '%s' cannot sign.
|
|||
sop.error.runtime.cert_cannot_encrypt=Certificate from input '%s' cannot encrypt.
|
||||
sop.error.runtime.no_session_key_extracted=Session key not extracted. Feature potentially not supported.
|
||||
sop.error.runtime.no_verifiable_signature_found=No verifiable signature found.
|
||||
sop.error.runtime.cannot_decrypt_message=Message could not be decrypted.
|
||||
## Usage errors
|
||||
sop.error.usage.password_or_cert_required=At least one password file or cert file required for encryption.
|
||||
sop.error.usage.argument_required=Argument '%s' is required.
|
||||
|
|
|
@ -64,6 +64,7 @@ sop.error.runtime.key_cannot_sign=Privater Schl
|
|||
sop.error.runtime.cert_cannot_encrypt=Zertifikat aus Eingabe '%s' kann nicht verschlüsseln.
|
||||
sop.error.runtime.no_session_key_extracted=Nachrichtenschlüssel nicht extrahiert. Funktion wird möglicherweise nicht unterstützt.
|
||||
sop.error.runtime.no_verifiable_signature_found=Keine gültigen Signaturen gefunden.
|
||||
sop.error.runtime.cannot_decrypt_message=Nachricht konnte nicht entschlüsselt werden.
|
||||
## Usage errors
|
||||
sop.error.usage.password_or_cert_required=Es wird mindestens ein Passwort und/oder Zertifikat zur Verschlüsselung benötigt.
|
||||
sop.error.usage.argument_required=Argument '%s' ist erforderlich.
|
||||
|
|
|
@ -119,6 +119,14 @@ public abstract class SOPGPException extends RuntimeException {
|
|||
|
||||
public static final int EXIT_CODE = 29;
|
||||
|
||||
public CannotDecrypt() {
|
||||
|
||||
}
|
||||
|
||||
public CannotDecrypt(String errorMsg, Throwable e) {
|
||||
super(errorMsg, e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getExitCode() {
|
||||
return EXIT_CODE;
|
||||
|
|
Loading…
Reference in a new issue