mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-12-17 00:34:20 -05:00
remove cli style error message wrapper which only keeps last line
This commit is contained in:
parent
b3f1c84aeb
commit
7cb9a4b6ac
1 changed files with 1 additions and 9 deletions
|
|
@ -24,7 +24,6 @@ import static io.grpc.Status.INVALID_ARGUMENT;
|
||||||
import static io.grpc.Status.UNKNOWN;
|
import static io.grpc.Status.UNKNOWN;
|
||||||
import io.grpc.StatusRuntimeException;
|
import io.grpc.StatusRuntimeException;
|
||||||
import io.grpc.stub.StreamObserver;
|
import io.grpc.stub.StreamObserver;
|
||||||
import java.util.function.Function;
|
|
||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
|
||||||
|
|
@ -72,7 +71,7 @@ class GrpcExceptionHandler {
|
||||||
// interface, an interface that is not allowed to throw exceptions.
|
// interface, an interface that is not allowed to throw exceptions.
|
||||||
log.error(errorMessage);
|
log.error(errorMessage);
|
||||||
var grpcStatusRuntimeException = new StatusRuntimeException(
|
var grpcStatusRuntimeException = new StatusRuntimeException(
|
||||||
UNKNOWN.withDescription(cliStyleErrorMessage.apply(errorMessage)));
|
UNKNOWN.withDescription(errorMessage));
|
||||||
responseObserver.onError(grpcStatusRuntimeException);
|
responseObserver.onError(grpcStatusRuntimeException);
|
||||||
throw grpcStatusRuntimeException;
|
throw grpcStatusRuntimeException;
|
||||||
}
|
}
|
||||||
|
|
@ -95,13 +94,6 @@ class GrpcExceptionHandler {
|
||||||
return new StatusRuntimeException(mapGrpcErrorStatus(t, "unexpected error on server"));
|
return new StatusRuntimeException(mapGrpcErrorStatus(t, "unexpected error on server"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private final Function<String, String> cliStyleErrorMessage = (e) -> {
|
|
||||||
String[] line = e.split("\\r?\\n");
|
|
||||||
int lastLine = line.length;
|
|
||||||
return line[lastLine - 1].toLowerCase();
|
|
||||||
};
|
|
||||||
|
|
||||||
private Status mapGrpcErrorStatus(Throwable t, String description) {
|
private Status mapGrpcErrorStatus(Throwable t, String description) {
|
||||||
// We default to the UNKNOWN status, except were the mapping of a core api
|
// We default to the UNKNOWN status, except were the mapping of a core api
|
||||||
// exception to a gRPC Status is obvious. If we ever use a gRPC reverse-proxy
|
// exception to a gRPC Status is obvious. If we ever use a gRPC reverse-proxy
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue