Skip to content

Commit 39febf7

Browse files
committed
add http status suffix
error messages differ too much across clients
1 parent 29e52a5 commit 39febf7

File tree

1 file changed

+3
-1
lines changed
  • kotlin-jira-client/kotlin-jira-client-sdk/src/main/kotlin/com/linkedplanet/kotlinjiraclient/sdk/util

1 file changed

+3
-1
lines changed

kotlin-jira-client/kotlin-jira-client-sdk/src/main/kotlin/com/linkedplanet/kotlinjiraclient/sdk/util/EitherExtension.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,12 @@ fun <T> withErrorCollection(
6060

6161
fun jiraClientError(errorCollection: ErrorCollection, errorTitle: String = "SdkError"): JiraClientError {
6262
val worstReason: ErrorCollection.Reason? = ErrorCollection.Reason.getWorstReason(errorCollection.reasons)
63+
val httpStatusSuffix = worstReason?.let { " (Status Code ${it.httpStatusCode})" } ?: ""
6364
return JiraClientError(
6465
error = errorTitle,
6566
message = errorCollection.errorMessages.joinToString(", \n")
66-
+ errorCollection.errors.map { "'${it.key}': ${it.value}" }.joinToString(", \n"),
67+
+ errorCollection.errors.map { "'${it.key}': ${it.value}" }.joinToString(", \n")
68+
+ httpStatusSuffix,
6769
statusCode = worstReason?.httpStatusCode
6870
)
6971
}

0 commit comments

Comments
 (0)