Skip to content

Commit 5c9ae93

Browse files
committed
Corrected error handling in HttpClient and children
1 parent c072451 commit 5c9ae93

File tree

2 files changed

+4
-5
lines changed
  • kotlin-http-client
    • kotlin-http-client-api/src/main/kotlin/com/linkedplanet/kotlinhttpclient/api/http
    • kotlin-http-client-atlas/src/main/kotlin/com/linkedplanet/kotlinhttpclient/atlas

2 files changed

+4
-5
lines changed

kotlin-http-client/kotlin-http-client-api/src/main/kotlin/com/linkedplanet/kotlinhttpclient/api/http/HttpClient.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package com.linkedplanet.kotlinhttpclient.api.http
22

33
import arrow.core.Either
4-
import com.linkedplanet.kotlinhttpclient.error.DomainError
54
import com.linkedplanet.kotlinhttpclient.error.HttpDomainError
65
import java.lang.reflect.Type
76

@@ -21,7 +20,7 @@ interface HttpClient {
2120
params: Map<String, String>,
2221
body: String?,
2322
contentType: String?
24-
): Either<DomainError, HttpResponse<ByteArray>>
23+
): Either<HttpDomainError, HttpResponse<ByteArray>>
2524

2625
suspend fun executeUpload(
2726
method: String,

kotlin-http-client/kotlin-http-client-atlas/src/main/kotlin/com/linkedplanet/kotlinhttpclient/atlas/AtlasHttpClient.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class AtlasHttpClient(private val appLink: ApplicationLink) : BaseHttpClient() {
7575
}
7676
})
7777
} catch (e: ResponseException) {
78-
Either.Left(HttpDomainError(-1, "Jira/Insight hat ein internes Problem festgestellt", ""))
78+
Either.Left(HttpDomainError(400, "Jira/Insight hat ein internes Problem festgestellt", e.message.toString()))
7979
}
8080

8181
override suspend fun executeDownload(
@@ -121,7 +121,7 @@ class AtlasHttpClient(private val appLink: ApplicationLink) : BaseHttpClient() {
121121
}
122122
})
123123
} catch (e: ResponseException) {
124-
Either.Left(HttpDomainError(-1, "Jira/Insight hat ein internes Problem festgestellt", ""))
124+
Either.Left(HttpDomainError(400, "Jira/Insight hat ein internes Problem festgestellt", e.message.toString()))
125125
}
126126

127127
override suspend fun executeUpload(
@@ -169,6 +169,6 @@ class AtlasHttpClient(private val appLink: ApplicationLink) : BaseHttpClient() {
169169
}
170170
})
171171
} catch (e: ResponseException) {
172-
Either.Left(HttpDomainError(-1, "Jira/Insight hat ein internes Problem festgestellt", ""))
172+
Either.Left(HttpDomainError(400, "Jira/Insight hat ein internes Problem festgestellt", e.message.toString()))
173173
}
174174
}

0 commit comments

Comments
 (0)