use of ai.grakn.grpc.GrpcUtil.ErrorType in project grakn by graknlabs.
the class GrpcClient method convertStatusRuntimeException.
private static RuntimeException convertStatusRuntimeException(StatusRuntimeException error) {
Status status = error.getStatus();
Metadata trailers = error.getTrailers();
ErrorType errorType = trailers.get(ErrorType.KEY);
if (errorType != null) {
String message = status.getDescription();
return errorType.toException(message);
} else {
return error;
}
}