mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-23 15:00:30 +01:00
Handle OptionException immediately
This commit is contained in:
parent
dee5e4cf7e
commit
e10e29a211
1 changed files with 34 additions and 30 deletions
|
@ -28,6 +28,7 @@ import io.grpc.StatusRuntimeException;
|
|||
|
||||
import joptsimple.OptionException;
|
||||
import joptsimple.OptionParser;
|
||||
import joptsimple.OptionSet;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
|
||||
|
@ -77,8 +78,13 @@ public class CliMain {
|
|||
var passwordOpt = parser.accepts("password", "rpc server password")
|
||||
.withRequiredArg();
|
||||
|
||||
OptionSet options = null;
|
||||
try {
|
||||
var options = parser.parse(args);
|
||||
options = parser.parse(args);
|
||||
} catch (OptionException ex) {
|
||||
err.println("Error: " + ex.getMessage());
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if (options.has(helpOpt)) {
|
||||
printHelp(parser, out);
|
||||
|
@ -110,6 +116,7 @@ public class CliMain {
|
|||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
try {
|
||||
var channel = ManagedChannelBuilder.forAddress(host, port).usePlaintext().build();
|
||||
var credentials = new PasswordCallCredentials(password);
|
||||
|
||||
|
@ -140,9 +147,6 @@ public class CliMain {
|
|||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
} catch (OptionException ex) {
|
||||
err.println("Error: " + ex.getMessage());
|
||||
exit(EXIT_FAILURE);
|
||||
} catch (StatusRuntimeException ex) {
|
||||
Throwable t = ex.getCause() == null ? ex : ex.getCause();
|
||||
err.println("Error: " + t.getMessage().replace("UNAUTHENTICATED: ", ""));
|
||||
|
|
Loading…
Add table
Reference in a new issue