File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
core/src/main/java/io/grpc/internal Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change 5656import io .grpc .ServerServiceDefinition ;
5757import io .grpc .ServerTransportFilter ;
5858import io .grpc .Status ;
59+ import io .grpc .StatusException ;
5960import io .grpc .StatusRuntimeException ;
6061import io .perfmark .Link ;
6162import io .perfmark .PerfMark ;
@@ -813,10 +814,14 @@ private void internalClose(Throwable t) {
813814 // TODO(ejona86): this is not thread-safe :)
814815 String description = "Application error processing RPC" ;
815816 Status statusToPropagate = Status .UNKNOWN .withDescription (description ).withCause (t );
817+ Status extractedStatus = null ;
816818 if (t instanceof StatusRuntimeException ) {
817- if (((StatusRuntimeException ) t ).getStatus ().getCode () == Status .Code .RESOURCE_EXHAUSTED ) {
818- statusToPropagate = ((StatusRuntimeException ) t ).getStatus ().withCause (t );
819- }
819+ extractedStatus = ((StatusRuntimeException ) t ).getStatus ();
820+ } else if (t instanceof StatusException ) {
821+ extractedStatus = ((StatusException ) t ).getStatus ();
822+ }
823+ if (extractedStatus != null && extractedStatus .getCode () == Status .Code .RESOURCE_EXHAUSTED ) {
824+ statusToPropagate = extractedStatus .withCause (t );
820825 }
821826 stream .close (statusToPropagate , new Metadata ());
822827 }
You can’t perform that action at this time.
0 commit comments