Even more refactoring

This commit is contained in:
Paul Schaub 2022-03-21 11:25:03 +01:00
parent f04a322ac4
commit c2d4d283bc
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311
14 changed files with 140 additions and 49 deletions

View file

@ -4,7 +4,8 @@
package pgp.wkd.cli;
import pgp.wkd.MissingUserIdException;
import pgp.wkd.exception.CertNotFetchableException;
import pgp.wkd.exception.RejectedCertificateException;
import pgp.wkd.cli.command.Fetch;
import picocli.CommandLine;
@ -28,8 +29,8 @@ public class WKDCLI {
.setExitCodeExceptionMapper(new CommandLine.IExitCodeExceptionMapper() {
@Override
public int getExitCode(Throwable exception) {
if (exception instanceof MissingUserIdException) {
return MissingUserIdException.ERROR_CODE;
if (exception instanceof RejectedCertificateException) {
return ((RejectedCertificateException) exception).getErrorCode();
} else if (exception instanceof CertNotFetchableException) {
return CertNotFetchableException.ERROR_CODE;
}