Skip to content

Commit

Permalink
Ikke kjør retry på ResourceAccessException
Browse files Browse the repository at this point in the history
  • Loading branch information
ugur93 committed Aug 28, 2024
1 parent 3555a7b commit 1ad5628
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ class RestExceptionHandler(private val exceptionLogger: ExceptionLogger) {

sealed class RestResponse<T> {
data class Success<T>(val body: T) : RestResponse<T>()
data class Failure<T>(val message: String?, val statusCode: HttpStatusCode, val restClientException: RestClientException) : RestResponse<T>()
data class Failure<T>(val message: String?, val statusCode: HttpStatusCode, val restClientException: Exception) : RestResponse<T>()
}
fun httpRetryTemplate(details: String? = null): RetryTemplate {
val retryTemplate = RetryTemplate()
Expand Down Expand Up @@ -210,6 +210,8 @@ fun <T> RestTemplate.tryExchange(
RestResponse.Failure("Message: ${e.message}", e.statusCode, e)
} catch (e: HttpServerErrorException) {
RestResponse.Failure("Message: ${e.message}", e.statusCode, e)
} catch (e: Exception) {
RestResponse.Failure("Message: ${e.message}", HttpStatus.INTERNAL_SERVER_ERROR, e)
}

// Brukes hvis responseType er en liste
Expand Down

0 comments on commit 1ad5628

Please sign in to comment.