find root exception
This commit is contained in:
parent
2d4bb80ac6
commit
e4157cbfb8
@ -43,8 +43,9 @@ public class Main {
|
||||
try {
|
||||
scriptClient.execute(command);
|
||||
console.println(formatter.format(scriptClient.getLastRpcResult()));
|
||||
} catch (Exception e) {
|
||||
console.println("Error: " + e.getLocalizedMessage() + "\n");
|
||||
} catch (JSCliException e) {
|
||||
final String errorMessage = createErrorMessage(e);
|
||||
console.println(errorMessage + "\n");
|
||||
}
|
||||
command = console.readInput();
|
||||
}
|
||||
@ -55,4 +56,17 @@ public class Main {
|
||||
}
|
||||
}
|
||||
|
||||
private static String createErrorMessage(final JSCliException e) {
|
||||
String errorMessage = "Error: " + e.getLocalizedMessage();
|
||||
Throwable cause = e;
|
||||
while (cause.getCause() != null) {
|
||||
cause = cause.getCause();
|
||||
}
|
||||
errorMessage = cause.getLocalizedMessage();
|
||||
if (errorMessage.contains("de.hsadmin.rpc.VOUserException:")) {
|
||||
errorMessage = errorMessage.substring(errorMessage.indexOf("de.hsadmin.rpc.VOUserException:") + 31).trim();
|
||||
}
|
||||
return errorMessage;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user