mirror of https://github.com/grpc/grpc-java.git
Specify Status*Exception is to be used in StreamObserver.onError
This commit is contained in:
parent
cd89dde625
commit
b0ed77ad81
|
@ -392,6 +392,8 @@ public final class Status {
|
|||
|
||||
/**
|
||||
* Extract an error {@link Status} from the causal chain of a {@link Throwable}.
|
||||
*
|
||||
* @return non-{@code null} status
|
||||
*/
|
||||
public static Status fromThrowable(Throwable t) {
|
||||
for (Throwable cause : Throwables.getCausalChain(t)) {
|
||||
|
|
|
@ -68,6 +68,12 @@ public interface StreamObserver<V> {
|
|||
* exception is thrown by an implementation of {@code onError} no further calls to any method are
|
||||
* allowed.
|
||||
*
|
||||
* <p>{@code t} should be a {@link io.grpc.StatusException} or {@link
|
||||
* io.grpc.StatusRuntimeException}, but other {@code Throwable} types are possible. Callers should
|
||||
* generally convert from a {@link io.grpc.Status} via {@link io.grpc.Status#asException()} or
|
||||
* {@link io.grpc.Status#asRuntimeException()}. Implementations should generally convert to a
|
||||
* {@code Status} via {@link io.grpc.Status#fromThrowable(Throwable)}.
|
||||
*
|
||||
* @param t the error occurred on the stream
|
||||
*/
|
||||
void onError(Throwable t);
|
||||
|
|
Loading…
Reference in New Issue