This commit is contained in:
crusader 2018-03-29 17:59:17 +09:00
parent d99f4f76eb
commit 396ab8c3ff

View File

@ -76,15 +76,19 @@ public class ServiceProxy {
responseObserver.onNext(reply);
responseObserver.onCompleted();
} catch (OverflowException e) {
logger.warning(e.toString());
logger.warning(getExceptionMessage(request, e));
responseObserver.onError(convertException(e));
} catch (OverflowRuntimeException e) {
logger.warning(e.toString());
logger.warning(getExceptionMessage(request, e));
responseObserver.onError(convertException(e));
}
}
private String getExceptionMessage(ServerInput request, Exception e) {
return String.format("Target: %s, Method:%s, Params:%s, ex:%s", request.getTarget(), request.getMethod(), request.getParamsList().asByteStringList(), e.toString());
}
protected StatusRuntimeException convertException(OverflowRuntimeException e) {
String message = String.format("%s|%s", e.getClass().getSimpleName(), e.getMessage());
Status status = Status.fromCode(Status.Code.INTERNAL).withDescription(message);