mirror of https://github.com/grpc/grpc-java.git
Add trailers to Status for BlockingResponseStream
This commit is contained in:
parent
641cb357c6
commit
6e40edbc21
|
|
@ -41,6 +41,7 @@ import io.grpc.ClientCall;
|
||||||
import io.grpc.Metadata;
|
import io.grpc.Metadata;
|
||||||
import io.grpc.MethodDescriptor;
|
import io.grpc.MethodDescriptor;
|
||||||
import io.grpc.Status;
|
import io.grpc.Status;
|
||||||
|
import io.grpc.StatusRuntimeException;
|
||||||
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.NoSuchElementException;
|
import java.util.NoSuchElementException;
|
||||||
|
|
@ -437,8 +438,10 @@ public class ClientCalls {
|
||||||
throw Status.CANCELLED.withCause(ie).asRuntimeException();
|
throw Status.CANCELLED.withCause(ie).asRuntimeException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (last instanceof Status) {
|
if (last instanceof StatusRuntimeException) {
|
||||||
throw ((Status) last).asRuntimeException();
|
// Rethrow the exception with a new stacktrace.
|
||||||
|
StatusRuntimeException e = (StatusRuntimeException) last;
|
||||||
|
throw e.getStatus().asRuntimeException(e.getTrailers());
|
||||||
}
|
}
|
||||||
return last != this;
|
return last != this;
|
||||||
}
|
}
|
||||||
|
|
@ -482,7 +485,7 @@ public class ClientCalls {
|
||||||
if (status.isOk()) {
|
if (status.isOk()) {
|
||||||
buffer.add(BlockingResponseStream.this);
|
buffer.add(BlockingResponseStream.this);
|
||||||
} else {
|
} else {
|
||||||
buffer.add(status);
|
buffer.add(status.asRuntimeException(trailers));
|
||||||
}
|
}
|
||||||
done = true;
|
done = true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue