MCPcopy Create free account
hub / github.com/grpc/grpc-java / trailersFromThrowable

Method trailersFromThrowable

api/src/main/java/io/grpc/Status.java:415–427  ·  view source on GitHub ↗

Extract an error trailers from the causal chain of a Throwable. @return the trailers or null if not found.

(Throwable t)

Source from the content-addressed store, hash-verified

413 * @return the trailers or {@code null} if not found.
414 */
415 @Nullable
416 public static Metadata trailersFromThrowable(Throwable t) {
417 Throwable cause = checkNotNull(t, "t");
418 while (cause != null) {
419 if (cause instanceof StatusException) {
420 return ((StatusException) cause).getTrailers();
421 } else if (cause instanceof StatusRuntimeException) {
422 return ((StatusRuntimeException) cause).getTrailers();
423 }
424 cause = cause.getCause();
425 }
426 return null;
427 }
428
429 static String formatThrowableMessage(Status status) {
430 if (status.description == null) {

Callers 5

startMethod · 0.95
verifyErrorReplyMethod · 0.95
unaryFutureCallFailedMethod · 0.95
onErrorMethod · 0.95

Calls 3

checkNotNullMethod · 0.80
getCauseMethod · 0.80
getTrailersMethod · 0.45

Tested by 2

unaryFutureCallFailedMethod · 0.76