@ExperimentalApi("https://github.com/grpc/grpc-java/issues/4683")
  public static Metadata trailersFromThrowable(Throwable t) {
    Throwable cause = checkNotNull(t, "t");
    while (cause != null) {
      if (cause instanceof StatusException) {
        return ((StatusException) cause).getTrailers();
      } else if (cause instanceof StatusRuntimeException) {
        return ((StatusRuntimeException) cause).getTrailers();
      }
      cause = cause.getCause();
    }
    return null;
  }
@ ExperimentalApi ( "https://github.com/grpc/grpc-java/issues/4683" ) public static Metadata trailersFromThrowable ( Throwable t ) { Throwable cause = checkNotNull ( t , "t" ) ; while ( cause != null ) { if ( cause instanceof StatusException ) { return ( ( StatusException ) cause ) . getTrailers ( ) ; } else if ( cause instanceof StatusRuntimeException ) { return ( ( StatusRuntimeException ) cause ) . getTrailers ( ) ; } cause = cause . getCause ( ) ; } return null ; }
Extract an error trailers from the causal chain of a {@link Throwable}.

@return the trailers or {@code null} if not found.