code: protected ErrorInfo getErrorInfo(GoogleJsonError details) {
      if (details == null) {
        return null;
      }
      List<ErrorInfo> errors = details.getErrors();
      return errors.isEmpty() ? null : errors.get(0);
    }
docs: Get the first ErrorInfo from a GoogleJsonError, or null if
  there is not one.