mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-23 06:55:08 +01:00
Generalize gRPC exception message cleanup
This commit is contained in:
parent
c7a6c87bd1
commit
6334c5478c
1 changed files with 2 additions and 10 deletions
|
@ -209,16 +209,8 @@ public class CliMain {
|
|||
}
|
||||
}
|
||||
} catch (StatusRuntimeException ex) {
|
||||
// The actual server error message is in a nested exception and we clean it
|
||||
// up a bit to make it more presentable.
|
||||
Throwable t = ex.getCause() == null ? ex : ex.getCause();
|
||||
String message = t.getMessage()
|
||||
.replace("FAILED_PRECONDITION: ", "")
|
||||
.replace("INTERNAL: ", "")
|
||||
.replace("INVALID_ARGUMENT: ", "")
|
||||
.replace("UNAUTHENTICATED: ", "")
|
||||
.replace("UNAVAILABLE: ", "")
|
||||
.replace("UNKNOWN: ", "");
|
||||
// Remove the leading gRPC status code (e.g. "UNKNOWN: ") from the message
|
||||
String message = ex.getMessage().replaceFirst("^[A-Z_]+: ", "");
|
||||
err.println("Error: " + message);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue