mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-23 23:06:39 +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) {
|
} catch (StatusRuntimeException ex) {
|
||||||
// The actual server error message is in a nested exception and we clean it
|
// Remove the leading gRPC status code (e.g. "UNKNOWN: ") from the message
|
||||||
// up a bit to make it more presentable.
|
String message = ex.getMessage().replaceFirst("^[A-Z_]+: ", "");
|
||||||
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: ", "");
|
|
||||||
err.println("Error: " + message);
|
err.println("Error: " + message);
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue