X-Git-Url: https://git.nmode.ca/signal-cli/blobdiff_plain/80c1a6d2af54a6925b88bc0c6dab8dd5a40c25f9..8d55dfb66bc0dfbd2b601a27075f2876cde918e3:/src/main/java/org/asamk/signal/Main.java?ds=inline diff --git a/src/main/java/org/asamk/signal/Main.java b/src/main/java/org/asamk/signal/Main.java index 0a30d202..00d9d7a9 100644 --- a/src/main/java/org/asamk/signal/Main.java +++ b/src/main/java/org/asamk/signal/Main.java @@ -109,18 +109,13 @@ public class Main { } private static int getStatusForError(final CommandException e) { - if (e instanceof UserErrorException) { - return 1; - } else if (e instanceof UnexpectedErrorException) { - return 2; - } else if (e instanceof IOErrorException) { - return 3; - } else if (e instanceof UntrustedKeyErrorException) { - return 4; - } else if (e instanceof RateLimitErrorException) { - return 5; - } else { - return 2; - } + return switch (e) { + case UserErrorException userErrorException -> 1; + case UnexpectedErrorException unexpectedErrorException -> 2; + case IOErrorException ioErrorException -> 3; + case UntrustedKeyErrorException untrustedKeyErrorException -> 4; + case RateLimitErrorException rateLimitErrorException -> 5; + case null, default -> 2; + }; } }