1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2025-09-09 18:29:39 +02:00

Wip: Adopt changes from the SOP specification version 2

This commit is contained in:
Paul Schaub 2021-07-19 18:20:52 +02:00
parent 829068d5a8
commit 788c82531e
17 changed files with 328 additions and 217 deletions

View file

@ -15,7 +15,7 @@
*/
package sop.exception;
public class SOPGPException extends Exception {
public abstract class SOPGPException extends RuntimeException {
public SOPGPException() {
super();
@ -29,10 +29,21 @@ public class SOPGPException extends Exception {
super(e);
}
public SOPGPException(String message, Throwable cause) {
super(message, cause);
}
public abstract int getExitCode();
public static class NoSignature extends SOPGPException {
public static final int EXIT_CODE = 3;
public NoSignature() {
super("No verifiable signature found.");
}
@Override
public int getExitCode() {
return EXIT_CODE;
}
@ -42,10 +53,15 @@ public class SOPGPException extends Exception {
public static final int EXIT_CODE = 13;
public UnsupportedAsymmetricAlgo(String message, Throwable e) {
super(message, e);
}
public UnsupportedAsymmetricAlgo(Throwable e) {
super(e);
}
@Override
public int getExitCode() {
return EXIT_CODE;
}
@ -54,12 +70,17 @@ public class SOPGPException extends Exception {
public static class CertCannotEncrypt extends SOPGPException {
public static final int EXIT_CODE = 17;
public CertCannotEncrypt(String message, Throwable cause) {
super(message, cause);
}
@Override
public int getExitCode() {
return EXIT_CODE;
}
}
public static class CertCannotSign extends SOPGPException {
public static class CertCannotSign extends Exception {
}
@ -71,6 +92,7 @@ public class SOPGPException extends Exception {
super(s);
}
@Override
public int getExitCode() {
return EXIT_CODE;
}
@ -80,6 +102,11 @@ public class SOPGPException extends Exception {
public static final int EXIT_CODE = 23;
public IncompleteVerification(String message) {
super(message);
}
@Override
public int getExitCode() {
return EXIT_CODE;
}
@ -89,6 +116,7 @@ public class SOPGPException extends Exception {
public static final int EXIT_CODE = 29;
@Override
public int getExitCode() {
return EXIT_CODE;
}
@ -98,6 +126,7 @@ public class SOPGPException extends Exception {
public static final int EXIT_CODE = 31;
@Override
public int getExitCode() {
return EXIT_CODE;
}
@ -107,6 +136,15 @@ public class SOPGPException extends Exception {
public static final int EXIT_CODE = 37;
public UnsupportedOption(String message) {
super(message);
}
public UnsupportedOption(String message, Throwable cause) {
super(message, cause);
}
@Override
public int getExitCode() {
return EXIT_CODE;
}
@ -120,6 +158,11 @@ public class SOPGPException extends Exception {
super(e);
}
public BadData(String message, BadData badData) {
super(message, badData);
}
@Override
public int getExitCode() {
return EXIT_CODE;
}
@ -129,6 +172,7 @@ public class SOPGPException extends Exception {
public static final int EXIT_CODE = 53;
@Override
public int getExitCode() {
return EXIT_CODE;
}
@ -136,20 +180,80 @@ public class SOPGPException extends Exception {
public static class OutputExists extends SOPGPException {
public static final int EXIT_CODE = 59;
public OutputExists(String message) {
super(message);
}
@Override
public int getExitCode() {
return EXIT_CODE;
}
}
public static class MissingInput extends SOPGPException {
public static final int EXIT_CODE = 61;
public MissingInput(String message, Throwable cause) {
super(message, cause);
}
@Override
public int getExitCode() {
return EXIT_CODE;
}
}
public static class KeyIsProtected extends SOPGPException {
public static final int EXIT_CODE = 67;
public KeyIsProtected() {
super();
}
public KeyIsProtected(String message, Throwable cause) {
super(message, cause);
}
@Override
public int getExitCode() {
return EXIT_CODE;
}
}
public static class AmbiguousInput extends SOPGPException {
}
public static class NotImplemented extends SOPGPException {
public static class UnsupportedSubcommand extends SOPGPException {
public static final int EXIT_CODE = 69;
public UnsupportedSubcommand(String message) {
super(message);
}
@Override
public int getExitCode() {
return EXIT_CODE;
}
}
public static class UnsupportedSpecialPrefix extends SOPGPException {
public static final int EXIT_CODE = 71;
@Override
public int getExitCode() {
return EXIT_CODE;
}
}
public static class AmbiguousInput extends SOPGPException {
public static final int EXIT_CODE = 73;
@Override
public int getExitCode() {
return EXIT_CODE;
}