File tree Expand file tree Collapse file tree
protobuf/src/main/java/io/grpc/protobuf Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -136,18 +136,25 @@ public static com.google.rpc.Status fromThrowable(Throwable t) {
136136 while (cause != null ) {
137137 if (cause instanceof StatusException ) {
138138 StatusException e = (StatusException ) cause ;
139- return toStatusProto (e .getStatus (), e .getTrailers ());
139+ return fromStatusAndTrailers (e .getStatus (), e .getTrailers ());
140140 } else if (cause instanceof StatusRuntimeException ) {
141141 StatusRuntimeException e = (StatusRuntimeException ) cause ;
142- return toStatusProto (e .getStatus (), e .getTrailers ());
142+ return fromStatusAndTrailers (e .getStatus (), e .getTrailers ());
143143 }
144144 cause = cause .getCause ();
145145 }
146146 return null ;
147147 }
148148
149+ /**
150+ * Extracts the google.rpc.Status from trailers, and makes sure they match the gRPC
151+ * {@code status}.
152+ *
153+ * @return the embedded google.rpc.Status or {@code null} if it is not present.
154+ * @since 1.10.0
155+ */
149156 @ Nullable
150- private static com .google .rpc .Status toStatusProto (Status status , Metadata trailers ) {
157+ public static com .google .rpc .Status fromStatusAndTrailers (Status status , Metadata trailers ) {
151158 if (trailers != null ) {
152159 com .google .rpc .Status statusProto = trailers .get (STATUS_DETAILS_KEY );
153160 if (statusProto != null ) {
You can’t perform that action at this time.
0 commit comments