Skip to content

Commit

Permalink
Improve error message after retry fails.
Browse files Browse the repository at this point in the history
modmuss50 committed Sep 10, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent e2b2baf commit 76d490b
Showing 4 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@ Add to your gradle plugins block:

```gradle
plugins {
id "me.modmuss50.mod-publish-plugin" version "0.7.3"
id "me.modmuss50.mod-publish-plugin" version "0.7.4"
}
```

2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@ plugins {
}

group = "me.modmuss50"
version = "0.7.3"
version = "0.7.4"
description = "The Mod Publish Plugin is a plugin for the Gradle build system to help upload artifacts to a range of common destinations."

repositories {
4 changes: 2 additions & 2 deletions docs/pages/getting_started.mdx
Original file line number Diff line number Diff line change
@@ -8,14 +8,14 @@ The plugin is hosted on the Gradle plugin portal, so can be easily added to your
<Tab>
```groovy
plugins {
id "me.modmuss50.mod-publish-plugin" version "0.7.3"
id "me.modmuss50.mod-publish-plugin" version "0.7.4"
}
```
</Tab>
<Tab>
```kotlin
plugins {
id("me.modmuss50.mod-publish-plugin") version "0.7.3"
id("me.modmuss50.mod-publish-plugin") version "0.7.4"
}
```
</Tab>
6 changes: 5 additions & 1 deletion src/main/kotlin/me/modmuss50/mpp/HttpUtils.kt
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@ import okhttp3.OkHttpClient
import okhttp3.Request
import okhttp3.RequestBody
import okhttp3.Response
import org.slf4j.LoggerFactory
import java.io.IOException
import java.lang.RuntimeException
import java.time.Duration
@@ -74,6 +75,8 @@ class HttpUtils(val exceptionFactory: HttpExceptionFactory = DefaultHttpExceptio
}

companion object {
private val LOGGER = LoggerFactory.getLogger(HttpUtils::class.java)

/**
* Retry server errors
*/
@@ -91,11 +94,12 @@ class HttpUtils(val exceptionFactory: HttpExceptionFactory = DefaultHttpExceptio

// Only retry 5xx server errors
count++
exception = exception ?: RuntimeException(message)
exception = exception ?: RuntimeException("$message after $maxRetries attempts with error: ${e.message}")
exception.addSuppressed(e)
}
}

LOGGER.error("$message failed after $maxRetries retries", exception)
throw exception!!
}
}

0 comments on commit 76d490b

Please sign in to comment.