code: public static ThrowableProto serializeThrowable(Throwable t) {
          final ThrowableProto.Builder builder = ThrowableProto.newBuilder();
  
          if (t instanceof StatusCauseException) {
              final StatusCauseException statusCause = (StatusCauseException) t;
              builder.setOriginalClassName(statusCause.getOriginalClassName());
              builder.setOriginalMessage(statusCause.getOriginalMessage());
          } else {
              builder.setOriginalClassName(t.getClass().getCanonicalName());
              builder.setOriginalMessage(Strings.nullToEmpty(t.getMessage()));
          }
  
          for (StackTraceElement element : t.getStackTrace()) {
              builder.addStackTrace(serializeStackTraceElement(element));
          }
  
          if (t.getCause() != null) {
              builder.setCause(serializeThrowable(t.getCause()));
          }
          return builder.build();
      }
docs: Fills the information from the {@link Throwable} into a {@link ThrowableProto} for
  returning to a client.