Search in sources :

Example 1 with ErrorType

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;
    }
}
Also used : Status(io.grpc.Status) ErrorType(ai.grakn.grpc.GrpcUtil.ErrorType) Metadata(io.grpc.Metadata)

Aggregations

ErrorType (ai.grakn.grpc.GrpcUtil.ErrorType)1 Metadata (io.grpc.Metadata)1 Status (io.grpc.Status)1