@Test public void fromThrowable_shouldReturnNullIfStatusDetailsKeyIsMissing() { Status status = Status.fromCodeValue(0); Metadata emptyMetadata = new Metadata(); assertNull(StatusProto.fromThrowable(status.asRuntimeException(emptyMetadata))); assertNull(StatusProto.fromThrowable(status.asException(emptyMetadata))); }
@Nullable public static com.google.rpc.Status fromThrowable(Throwable t) { Throwable cause = checkNotNull(t, "t"); while (cause != null) { if (cause instanceof StatusException) { StatusException e = (StatusException) cause; return fromStatusAndTrailers(e.getStatus(), e.getTrailers()); } else if (cause instanceof StatusRuntimeException) { StatusRuntimeException e = (StatusRuntimeException) cause; return fromStatusAndTrailers(e.getStatus(), e.getTrailers()); } cause = cause.getCause(); } return null; }
StatusProto { @Nullable public static com.google.rpc.Status fromThrowable(Throwable t) { Throwable cause = checkNotNull(t, "t"); while (cause != null) { if (cause instanceof StatusException) { StatusException e = (StatusException) cause; return fromStatusAndTrailers(e.getStatus(), e.getTrailers()); } else if (cause instanceof StatusRuntimeException) { StatusRuntimeException e = (StatusRuntimeException) cause; return fromStatusAndTrailers(e.getStatus(), e.getTrailers()); } cause = cause.getCause(); } return null; } }
StatusProto { @Nullable public static com.google.rpc.Status fromThrowable(Throwable t) { Throwable cause = checkNotNull(t, "t"); while (cause != null) { if (cause instanceof StatusException) { StatusException e = (StatusException) cause; return fromStatusAndTrailers(e.getStatus(), e.getTrailers()); } else if (cause instanceof StatusRuntimeException) { StatusRuntimeException e = (StatusRuntimeException) cause; return fromStatusAndTrailers(e.getStatus(), e.getTrailers()); } cause = cause.getCause(); } return null; } private  StatusProto(); }
StatusProto { @Nullable public static com.google.rpc.Status fromThrowable(Throwable t) { Throwable cause = checkNotNull(t, "t"); while (cause != null) { if (cause instanceof StatusException) { StatusException e = (StatusException) cause; return fromStatusAndTrailers(e.getStatus(), e.getTrailers()); } else if (cause instanceof StatusRuntimeException) { StatusRuntimeException e = (StatusRuntimeException) cause; return fromStatusAndTrailers(e.getStatus(), e.getTrailers()); } cause = cause.getCause(); } return null; } private  StatusProto(); static StatusRuntimeException toStatusRuntimeException(com.google.rpc.Status statusProto); static StatusRuntimeException toStatusRuntimeException(
      com.google.rpc.Status statusProto, Metadata metadata); static StatusException toStatusException(com.google.rpc.Status statusProto); static StatusException toStatusException(
      com.google.rpc.Status statusProto, Metadata metadata); @Nullable static com.google.rpc.Status fromThrowable(Throwable t); @Nullable static com.google.rpc.Status fromStatusAndTrailers(Status status, Metadata trailers); }
StatusProto { @Nullable public static com.google.rpc.Status fromThrowable(Throwable t) { Throwable cause = checkNotNull(t, "t"); while (cause != null) { if (cause instanceof StatusException) { StatusException e = (StatusException) cause; return fromStatusAndTrailers(e.getStatus(), e.getTrailers()); } else if (cause instanceof StatusRuntimeException) { StatusRuntimeException e = (StatusRuntimeException) cause; return fromStatusAndTrailers(e.getStatus(), e.getTrailers()); } cause = cause.getCause(); } return null; } private  StatusProto(); static StatusRuntimeException toStatusRuntimeException(com.google.rpc.Status statusProto); static StatusRuntimeException toStatusRuntimeException(
      com.google.rpc.Status statusProto, Metadata metadata); static StatusException toStatusException(com.google.rpc.Status statusProto); static StatusException toStatusException(
      com.google.rpc.Status statusProto, Metadata metadata); @Nullable static com.google.rpc.Status fromThrowable(Throwable t); @Nullable static com.google.rpc.Status fromStatusAndTrailers(Status status, Metadata trailers);  }