@Test public void isApiRequestRetryable() { for (Map.Entry<Throwable, Boolean> entry : CODES_TO_EXCEPTIONS.entrySet()) { assertTrue(entry.getValue() == ExceptionSupport.isApiRequestRetryable(entry.getKey())); } }
@SuppressWarnings("WeakerAccess") @VisibleForTesting static boolean isApiRequestRetryable(Throwable e) { if (e instanceof Error) { logger.error(String.format("non_retryable_error_class_api %s %s", e.getClass(), e.getMessage()), e); return false; } if (e instanceof NonRetryableNakadiException) { logger.error(String.format("non_retryable_nakadi_exception_api %s %s", e.getClass(), e.getMessage()), e); return false; } if (e instanceof NotFoundException) { logger.error(String.format("non_retryable_not_found_exception_api %s %s", e.getClass(), e.getMessage()), e); return false; } if (e instanceof NakadiException) { logger.info(String.format("retryable_nakadi_exception %s %s", e.getClass(), e.getMessage()), e); return true; } logger.info( String.format("retryable_exception %s %s", e.getClass(), e.getMessage()), e); return true; }
ExceptionSupport { @SuppressWarnings("WeakerAccess") @VisibleForTesting static boolean isApiRequestRetryable(Throwable e) { if (e instanceof Error) { logger.error(String.format("non_retryable_error_class_api %s %s", e.getClass(), e.getMessage()), e); return false; } if (e instanceof NonRetryableNakadiException) { logger.error(String.format("non_retryable_nakadi_exception_api %s %s", e.getClass(), e.getMessage()), e); return false; } if (e instanceof NotFoundException) { logger.error(String.format("non_retryable_not_found_exception_api %s %s", e.getClass(), e.getMessage()), e); return false; } if (e instanceof NakadiException) { logger.info(String.format("retryable_nakadi_exception %s %s", e.getClass(), e.getMessage()), e); return true; } logger.info( String.format("retryable_exception %s %s", e.getClass(), e.getMessage()), e); return true; } }
ExceptionSupport { @SuppressWarnings("WeakerAccess") @VisibleForTesting static boolean isApiRequestRetryable(Throwable e) { if (e instanceof Error) { logger.error(String.format("non_retryable_error_class_api %s %s", e.getClass(), e.getMessage()), e); return false; } if (e instanceof NonRetryableNakadiException) { logger.error(String.format("non_retryable_nakadi_exception_api %s %s", e.getClass(), e.getMessage()), e); return false; } if (e instanceof NotFoundException) { logger.error(String.format("non_retryable_not_found_exception_api %s %s", e.getClass(), e.getMessage()), e); return false; } if (e instanceof NakadiException) { logger.info(String.format("retryable_nakadi_exception %s %s", e.getClass(), e.getMessage()), e); return true; } logger.info( String.format("retryable_exception %s %s", e.getClass(), e.getMessage()), e); return true; }  }
ExceptionSupport { @SuppressWarnings("WeakerAccess") @VisibleForTesting static boolean isApiRequestRetryable(Throwable e) { if (e instanceof Error) { logger.error(String.format("non_retryable_error_class_api %s %s", e.getClass(), e.getMessage()), e); return false; } if (e instanceof NonRetryableNakadiException) { logger.error(String.format("non_retryable_nakadi_exception_api %s %s", e.getClass(), e.getMessage()), e); return false; } if (e instanceof NotFoundException) { logger.error(String.format("non_retryable_not_found_exception_api %s %s", e.getClass(), e.getMessage()), e); return false; } if (e instanceof NakadiException) { logger.info(String.format("retryable_nakadi_exception %s %s", e.getClass(), e.getMessage()), e); return true; } logger.info( String.format("retryable_exception %s %s", e.getClass(), e.getMessage()), e); return true; }   }
ExceptionSupport { @SuppressWarnings("WeakerAccess") @VisibleForTesting static boolean isApiRequestRetryable(Throwable e) { if (e instanceof Error) { logger.error(String.format("non_retryable_error_class_api %s %s", e.getClass(), e.getMessage()), e); return false; } if (e instanceof NonRetryableNakadiException) { logger.error(String.format("non_retryable_nakadi_exception_api %s %s", e.getClass(), e.getMessage()), e); return false; } if (e instanceof NotFoundException) { logger.error(String.format("non_retryable_not_found_exception_api %s %s", e.getClass(), e.getMessage()), e); return false; } if (e instanceof NakadiException) { logger.info(String.format("retryable_nakadi_exception %s %s", e.getClass(), e.getMessage()), e); return true; } logger.info( String.format("retryable_exception %s %s", e.getClass(), e.getMessage()), e); return true; }    }