Skip to content

Commit 0ebf5d4

Browse files
Update exit codes + Cleanup
Signed-off-by: miguelfigueiredo <[email protected]>
1 parent 8cb1b58 commit 0ebf5d4

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

command/src/com/mirth/connect/cli/CommandLineInterface.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -180,22 +180,22 @@ private void runShell(String server, String user, String password, String script
180180
client = new Client(server);
181181
this.debug = debug;
182182

183-
LoginStatus loginStatus;
183+
LoginStatus loginStatus = null;
184184
try {
185185
loginStatus = client.login(user, password);
186186
} catch (UnauthorizedException ex) {
187-
if (ex.getResponse() instanceof LoginStatus status) {
187+
if (ex.getResponse() instanceof LoginStatus status && status.isSuccess()) {
188188
loginStatus = status;
189-
}
190-
else {
191-
error("Could not login to server.", ex);
192-
return;
193189
}
194190
}
195-
196-
if (!loginStatus.isSuccess()) {
197-
error("Could not login to server. Status: " + loginStatus.getStatus(), null);
198-
return;
191+
finally {
192+
if (loginStatus == null) {
193+
error("Could not login to server");
194+
System.exit(70);
195+
}
196+
else if (!loginStatus.isSuccess()) {
197+
error("Could not login to server. Please check your username and password and try again.", null); System.exit(77);
198+
}
199199
}
200200

201201
String serverVersion = client.getVersion();

0 commit comments

Comments
 (0)