diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index fbd9082d7..4a2f7e609 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "1.5.0"
+ ".": "1.5.1"
}
\ No newline at end of file
diff --git a/.stats.yml b/.stats.yml
index d44c6fa94..9450f45c5 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
configured_endpoints: 116
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-612316c13276a207f56e2e2c7bbc68f4bb73de85e3661595a23f23d9ccc80276.yml
openapi_spec_hash: 6e125f05e40521ec485edf6e15beec2e
-config_hash: 3c3524be9607afb24d2139ce26ce5389
+config_hash: 8c9a47f104c777e2a1e8f3fad15c093b
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4a90db914..c220f91a8 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,13 @@
# Changelog
+## 1.5.1 (2025-07-17)
+
+Full Changelog: [v1.5.0...v1.5.1](https://github.com/orbcorp/orb-java/compare/v1.5.0...v1.5.1)
+
+### Bug Fixes
+
+* **client:** ensure error handling always occurs ([833326e](https://github.com/orbcorp/orb-java/commit/833326e6f35b4b8575002fc31f89f8292343a9e0))
+
## 1.5.0 (2025-07-16)
Full Changelog: [v1.4.0...v1.5.0](https://github.com/orbcorp/orb-java/compare/v1.4.0...v1.5.0)
diff --git a/README.md b/README.md
index 6597099bd..cc85f41f8 100644
--- a/README.md
+++ b/README.md
@@ -2,7 +2,7 @@
-[](https://central.sonatype.com/artifact/com.withorb.api/orb-java/1.5.0)
+[](https://central.sonatype.com/artifact/com.withorb.api/orb-java/1.5.1)
@@ -19,7 +19,7 @@ The REST API documentation can be found on [docs.withorb.com](https://docs.witho
### Gradle
```kotlin
-implementation("com.withorb.api:orb-java:1.5.0")
+implementation("com.withorb.api:orb-java:1.5.1")
```
### Maven
@@ -28,7 +28,7 @@ implementation("com.withorb.api:orb-java:1.5.0")
com.withorb.api
orb-java
- 1.5.0
+ 1.5.1
```
diff --git a/build.gradle.kts b/build.gradle.kts
index d893df117..103754787 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -1,4 +1,4 @@
allprojects {
group = "com.withorb.api"
- version = "1.5.0" // x-release-please-version
+ version = "1.5.1" // x-release-please-version
}
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/core/handlers/ErrorHandler.kt b/orb-java-core/src/main/kotlin/com/withorb/api/core/handlers/ErrorHandler.kt
index 70ed82f39..335878efc 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/core/handlers/ErrorHandler.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/core/handlers/ErrorHandler.kt
@@ -19,7 +19,7 @@ import com.withorb.api.errors.UnexpectedStatusCodeException
import com.withorb.api.errors.UnprocessableEntityException
@JvmSynthetic
-internal fun errorHandler(jsonMapper: JsonMapper): Handler {
+internal fun errorBodyHandler(jsonMapper: JsonMapper): Handler {
val handler = jsonHandler(jsonMapper)
return object : Handler {
@@ -33,52 +33,52 @@ internal fun errorHandler(jsonMapper: JsonMapper): Handler {
}
@JvmSynthetic
-internal fun Handler.withErrorHandler(errorHandler: Handler): Handler =
- object : Handler {
- override fun handle(response: HttpResponse): T =
+internal fun errorHandler(errorBodyHandler: Handler): Handler =
+ object : Handler {
+ override fun handle(response: HttpResponse): HttpResponse =
when (val statusCode = response.statusCode()) {
- in 200..299 -> this@withErrorHandler.handle(response)
+ in 200..299 -> response
400 ->
throw BadRequestException.builder()
.headers(response.headers())
- .body(errorHandler.handle(response))
+ .body(errorBodyHandler.handle(response))
.build()
401 ->
throw UnauthorizedException.builder()
.headers(response.headers())
- .body(errorHandler.handle(response))
+ .body(errorBodyHandler.handle(response))
.build()
403 ->
throw PermissionDeniedException.builder()
.headers(response.headers())
- .body(errorHandler.handle(response))
+ .body(errorBodyHandler.handle(response))
.build()
404 ->
throw NotFoundException.builder()
.headers(response.headers())
- .body(errorHandler.handle(response))
+ .body(errorBodyHandler.handle(response))
.build()
422 ->
throw UnprocessableEntityException.builder()
.headers(response.headers())
- .body(errorHandler.handle(response))
+ .body(errorBodyHandler.handle(response))
.build()
429 ->
throw RateLimitException.builder()
.headers(response.headers())
- .body(errorHandler.handle(response))
+ .body(errorBodyHandler.handle(response))
.build()
in 500..599 ->
throw InternalServerException.builder()
.statusCode(statusCode)
.headers(response.headers())
- .body(errorHandler.handle(response))
+ .body(errorBodyHandler.handle(response))
.build()
else ->
throw UnexpectedStatusCodeException.builder()
.statusCode(statusCode)
.headers(response.headers())
- .body(errorHandler.handle(response))
+ .body(errorBodyHandler.handle(response))
.build()
}
}
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/AlertServiceAsyncImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/AlertServiceAsyncImpl.kt
index 158399fbc..37fde9f01 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/AlertServiceAsyncImpl.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/AlertServiceAsyncImpl.kt
@@ -3,14 +3,14 @@
package com.withorb.api.services.async
import com.withorb.api.core.ClientOptions
-import com.withorb.api.core.JsonValue
import com.withorb.api.core.RequestOptions
import com.withorb.api.core.checkRequired
+import com.withorb.api.core.handlers.errorBodyHandler
import com.withorb.api.core.handlers.errorHandler
import com.withorb.api.core.handlers.jsonHandler
-import com.withorb.api.core.handlers.withErrorHandler
import com.withorb.api.core.http.HttpMethod
import com.withorb.api.core.http.HttpRequest
+import com.withorb.api.core.http.HttpResponse
import com.withorb.api.core.http.HttpResponse.Handler
import com.withorb.api.core.http.HttpResponseFor
import com.withorb.api.core.http.json
@@ -102,7 +102,8 @@ class AlertServiceAsyncImpl internal constructor(private val clientOptions: Clie
class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) :
AlertServiceAsync.WithRawResponse {
- private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper)
+ private val errorHandler: Handler =
+ errorHandler(errorBodyHandler(clientOptions.jsonMapper))
override fun withOptions(
modifier: Consumer
@@ -111,8 +112,7 @@ class AlertServiceAsyncImpl internal constructor(private val clientOptions: Clie
clientOptions.toBuilder().apply(modifier::accept).build()
)
- private val retrieveHandler: Handler =
- jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler)
+ private val retrieveHandler: Handler = jsonHandler(clientOptions.jsonMapper)
override fun retrieve(
params: AlertRetrieveParams,
@@ -132,7 +132,7 @@ class AlertServiceAsyncImpl internal constructor(private val clientOptions: Clie
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { retrieveHandler.handle(it) }
.also {
@@ -144,8 +144,7 @@ class AlertServiceAsyncImpl internal constructor(private val clientOptions: Clie
}
}
- private val updateHandler: Handler =
- jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler)
+ private val updateHandler: Handler = jsonHandler(clientOptions.jsonMapper)
override fun update(
params: AlertUpdateParams,
@@ -166,7 +165,7 @@ class AlertServiceAsyncImpl internal constructor(private val clientOptions: Clie
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { updateHandler.handle(it) }
.also {
@@ -180,7 +179,6 @@ class AlertServiceAsyncImpl internal constructor(private val clientOptions: Clie
private val listHandler: Handler =
jsonHandler(clientOptions.jsonMapper)
- .withErrorHandler(errorHandler)
override fun list(
params: AlertListParams,
@@ -197,7 +195,7 @@ class AlertServiceAsyncImpl internal constructor(private val clientOptions: Clie
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { listHandler.handle(it) }
.also {
@@ -218,7 +216,7 @@ class AlertServiceAsyncImpl internal constructor(private val clientOptions: Clie
}
private val createForCustomerHandler: Handler =
- jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler)
+ jsonHandler(clientOptions.jsonMapper)
override fun createForCustomer(
params: AlertCreateForCustomerParams,
@@ -239,7 +237,7 @@ class AlertServiceAsyncImpl internal constructor(private val clientOptions: Clie
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { createForCustomerHandler.handle(it) }
.also {
@@ -252,7 +250,7 @@ class AlertServiceAsyncImpl internal constructor(private val clientOptions: Clie
}
private val createForExternalCustomerHandler: Handler =
- jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler)
+ jsonHandler(clientOptions.jsonMapper)
override fun createForExternalCustomer(
params: AlertCreateForExternalCustomerParams,
@@ -273,7 +271,7 @@ class AlertServiceAsyncImpl internal constructor(private val clientOptions: Clie
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { createForExternalCustomerHandler.handle(it) }
.also {
@@ -286,7 +284,7 @@ class AlertServiceAsyncImpl internal constructor(private val clientOptions: Clie
}
private val createForSubscriptionHandler: Handler =
- jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler)
+ jsonHandler(clientOptions.jsonMapper)
override fun createForSubscription(
params: AlertCreateForSubscriptionParams,
@@ -307,7 +305,7 @@ class AlertServiceAsyncImpl internal constructor(private val clientOptions: Clie
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { createForSubscriptionHandler.handle(it) }
.also {
@@ -319,8 +317,7 @@ class AlertServiceAsyncImpl internal constructor(private val clientOptions: Clie
}
}
- private val disableHandler: Handler =
- jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler)
+ private val disableHandler: Handler = jsonHandler(clientOptions.jsonMapper)
override fun disable(
params: AlertDisableParams,
@@ -341,7 +338,7 @@ class AlertServiceAsyncImpl internal constructor(private val clientOptions: Clie
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { disableHandler.handle(it) }
.also {
@@ -353,8 +350,7 @@ class AlertServiceAsyncImpl internal constructor(private val clientOptions: Clie
}
}
- private val enableHandler: Handler =
- jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler)
+ private val enableHandler: Handler = jsonHandler(clientOptions.jsonMapper)
override fun enable(
params: AlertEnableParams,
@@ -375,7 +371,7 @@ class AlertServiceAsyncImpl internal constructor(private val clientOptions: Clie
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { enableHandler.handle(it) }
.also {
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/BetaServiceAsyncImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/BetaServiceAsyncImpl.kt
index 5cb71fb13..9af837003 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/BetaServiceAsyncImpl.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/BetaServiceAsyncImpl.kt
@@ -3,14 +3,14 @@
package com.withorb.api.services.async
import com.withorb.api.core.ClientOptions
-import com.withorb.api.core.JsonValue
import com.withorb.api.core.RequestOptions
import com.withorb.api.core.checkRequired
+import com.withorb.api.core.handlers.errorBodyHandler
import com.withorb.api.core.handlers.errorHandler
import com.withorb.api.core.handlers.jsonHandler
-import com.withorb.api.core.handlers.withErrorHandler
import com.withorb.api.core.http.HttpMethod
import com.withorb.api.core.http.HttpRequest
+import com.withorb.api.core.http.HttpResponse
import com.withorb.api.core.http.HttpResponse.Handler
import com.withorb.api.core.http.HttpResponseFor
import com.withorb.api.core.http.json
@@ -69,7 +69,8 @@ class BetaServiceAsyncImpl internal constructor(private val clientOptions: Clien
class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) :
BetaServiceAsync.WithRawResponse {
- private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper)
+ private val errorHandler: Handler =
+ errorHandler(errorBodyHandler(clientOptions.jsonMapper))
private val externalPlanId: ExternalPlanIdServiceAsync.WithRawResponse by lazy {
ExternalPlanIdServiceAsyncImpl.WithRawResponseImpl(clientOptions)
@@ -85,7 +86,7 @@ class BetaServiceAsyncImpl internal constructor(private val clientOptions: Clien
override fun externalPlanId(): ExternalPlanIdServiceAsync.WithRawResponse = externalPlanId
private val createPlanVersionHandler: Handler =
- jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler)
+ jsonHandler(clientOptions.jsonMapper)
override fun createPlanVersion(
params: BetaCreatePlanVersionParams,
@@ -106,7 +107,7 @@ class BetaServiceAsyncImpl internal constructor(private val clientOptions: Clien
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { createPlanVersionHandler.handle(it) }
.also {
@@ -119,7 +120,7 @@ class BetaServiceAsyncImpl internal constructor(private val clientOptions: Clien
}
private val fetchPlanVersionHandler: Handler =
- jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler)
+ jsonHandler(clientOptions.jsonMapper)
override fun fetchPlanVersion(
params: BetaFetchPlanVersionParams,
@@ -144,7 +145,7 @@ class BetaServiceAsyncImpl internal constructor(private val clientOptions: Clien
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { fetchPlanVersionHandler.handle(it) }
.also {
@@ -157,7 +158,7 @@ class BetaServiceAsyncImpl internal constructor(private val clientOptions: Clien
}
private val setDefaultPlanVersionHandler: Handler =
- jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler)
+ jsonHandler(clientOptions.jsonMapper)
override fun setDefaultPlanVersion(
params: BetaSetDefaultPlanVersionParams,
@@ -178,7 +179,7 @@ class BetaServiceAsyncImpl internal constructor(private val clientOptions: Clien
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { setDefaultPlanVersionHandler.handle(it) }
.also {
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/CouponServiceAsyncImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/CouponServiceAsyncImpl.kt
index 77fe37124..d25042cbd 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/CouponServiceAsyncImpl.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/CouponServiceAsyncImpl.kt
@@ -3,14 +3,14 @@
package com.withorb.api.services.async
import com.withorb.api.core.ClientOptions
-import com.withorb.api.core.JsonValue
import com.withorb.api.core.RequestOptions
import com.withorb.api.core.checkRequired
+import com.withorb.api.core.handlers.errorBodyHandler
import com.withorb.api.core.handlers.errorHandler
import com.withorb.api.core.handlers.jsonHandler
-import com.withorb.api.core.handlers.withErrorHandler
import com.withorb.api.core.http.HttpMethod
import com.withorb.api.core.http.HttpRequest
+import com.withorb.api.core.http.HttpResponse
import com.withorb.api.core.http.HttpResponse.Handler
import com.withorb.api.core.http.HttpResponseFor
import com.withorb.api.core.http.json
@@ -78,7 +78,8 @@ class CouponServiceAsyncImpl internal constructor(private val clientOptions: Cli
class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) :
CouponServiceAsync.WithRawResponse {
- private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper)
+ private val errorHandler: Handler =
+ errorHandler(errorBodyHandler(clientOptions.jsonMapper))
private val subscriptions: SubscriptionServiceAsync.WithRawResponse by lazy {
SubscriptionServiceAsyncImpl.WithRawResponseImpl(clientOptions)
@@ -93,8 +94,7 @@ class CouponServiceAsyncImpl internal constructor(private val clientOptions: Cli
override fun subscriptions(): SubscriptionServiceAsync.WithRawResponse = subscriptions
- private val createHandler: Handler =
- jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler)
+ private val createHandler: Handler = jsonHandler(clientOptions.jsonMapper)
override fun create(
params: CouponCreateParams,
@@ -112,7 +112,7 @@ class CouponServiceAsyncImpl internal constructor(private val clientOptions: Cli
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { createHandler.handle(it) }
.also {
@@ -126,7 +126,6 @@ class CouponServiceAsyncImpl internal constructor(private val clientOptions: Cli
private val listHandler: Handler =
jsonHandler(clientOptions.jsonMapper)
- .withErrorHandler(errorHandler)
override fun list(
params: CouponListParams,
@@ -143,7 +142,7 @@ class CouponServiceAsyncImpl internal constructor(private val clientOptions: Cli
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { listHandler.handle(it) }
.also {
@@ -163,8 +162,7 @@ class CouponServiceAsyncImpl internal constructor(private val clientOptions: Cli
}
}
- private val archiveHandler: Handler =
- jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler)
+ private val archiveHandler: Handler = jsonHandler(clientOptions.jsonMapper)
override fun archive(
params: CouponArchiveParams,
@@ -185,7 +183,7 @@ class CouponServiceAsyncImpl internal constructor(private val clientOptions: Cli
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { archiveHandler.handle(it) }
.also {
@@ -197,8 +195,7 @@ class CouponServiceAsyncImpl internal constructor(private val clientOptions: Cli
}
}
- private val fetchHandler: Handler =
- jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler)
+ private val fetchHandler: Handler = jsonHandler(clientOptions.jsonMapper)
override fun fetch(
params: CouponFetchParams,
@@ -218,7 +215,7 @@ class CouponServiceAsyncImpl internal constructor(private val clientOptions: Cli
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { fetchHandler.handle(it) }
.also {
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/CreditNoteServiceAsyncImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/CreditNoteServiceAsyncImpl.kt
index c803b1834..ab1a9466a 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/CreditNoteServiceAsyncImpl.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/CreditNoteServiceAsyncImpl.kt
@@ -3,14 +3,14 @@
package com.withorb.api.services.async
import com.withorb.api.core.ClientOptions
-import com.withorb.api.core.JsonValue
import com.withorb.api.core.RequestOptions
import com.withorb.api.core.checkRequired
+import com.withorb.api.core.handlers.errorBodyHandler
import com.withorb.api.core.handlers.errorHandler
import com.withorb.api.core.handlers.jsonHandler
-import com.withorb.api.core.handlers.withErrorHandler
import com.withorb.api.core.http.HttpMethod
import com.withorb.api.core.http.HttpRequest
+import com.withorb.api.core.http.HttpResponse
import com.withorb.api.core.http.HttpResponse.Handler
import com.withorb.api.core.http.HttpResponseFor
import com.withorb.api.core.http.json
@@ -62,7 +62,8 @@ class CreditNoteServiceAsyncImpl internal constructor(private val clientOptions:
class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) :
CreditNoteServiceAsync.WithRawResponse {
- private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper)
+ private val errorHandler: Handler =
+ errorHandler(errorBodyHandler(clientOptions.jsonMapper))
override fun withOptions(
modifier: Consumer
@@ -72,7 +73,7 @@ class CreditNoteServiceAsyncImpl internal constructor(private val clientOptions:
)
private val createHandler: Handler =
- jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler)
+ jsonHandler(clientOptions.jsonMapper)
override fun create(
params: CreditNoteCreateParams,
@@ -90,7 +91,7 @@ class CreditNoteServiceAsyncImpl internal constructor(private val clientOptions:
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { createHandler.handle(it) }
.also {
@@ -104,7 +105,6 @@ class CreditNoteServiceAsyncImpl internal constructor(private val clientOptions:
private val listHandler: Handler =
jsonHandler(clientOptions.jsonMapper)
- .withErrorHandler(errorHandler)
override fun list(
params: CreditNoteListParams,
@@ -121,7 +121,7 @@ class CreditNoteServiceAsyncImpl internal constructor(private val clientOptions:
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { listHandler.handle(it) }
.also {
@@ -142,7 +142,7 @@ class CreditNoteServiceAsyncImpl internal constructor(private val clientOptions:
}
private val fetchHandler: Handler =
- jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler)
+ jsonHandler(clientOptions.jsonMapper)
override fun fetch(
params: CreditNoteFetchParams,
@@ -162,7 +162,7 @@ class CreditNoteServiceAsyncImpl internal constructor(private val clientOptions:
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { fetchHandler.handle(it) }
.also {
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/CustomerServiceAsyncImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/CustomerServiceAsyncImpl.kt
index 20edac10c..e4c490df1 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/CustomerServiceAsyncImpl.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/CustomerServiceAsyncImpl.kt
@@ -3,13 +3,12 @@
package com.withorb.api.services.async
import com.withorb.api.core.ClientOptions
-import com.withorb.api.core.JsonValue
import com.withorb.api.core.RequestOptions
import com.withorb.api.core.checkRequired
import com.withorb.api.core.handlers.emptyHandler
+import com.withorb.api.core.handlers.errorBodyHandler
import com.withorb.api.core.handlers.errorHandler
import com.withorb.api.core.handlers.jsonHandler
-import com.withorb.api.core.handlers.withErrorHandler
import com.withorb.api.core.http.HttpMethod
import com.withorb.api.core.http.HttpRequest
import com.withorb.api.core.http.HttpResponse
@@ -135,7 +134,8 @@ class CustomerServiceAsyncImpl internal constructor(private val clientOptions: C
class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) :
CustomerServiceAsync.WithRawResponse {
- private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper)
+ private val errorHandler: Handler =
+ errorHandler(errorBodyHandler(clientOptions.jsonMapper))
private val costs: CostServiceAsync.WithRawResponse by lazy {
CostServiceAsyncImpl.WithRawResponseImpl(clientOptions)
@@ -164,7 +164,7 @@ class CustomerServiceAsyncImpl internal constructor(private val clientOptions: C
balanceTransactions
private val createHandler: Handler =
- jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler)
+ jsonHandler(clientOptions.jsonMapper)
override fun create(
params: CustomerCreateParams,
@@ -182,7 +182,7 @@ class CustomerServiceAsyncImpl internal constructor(private val clientOptions: C
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { createHandler.handle(it) }
.also {
@@ -195,7 +195,7 @@ class CustomerServiceAsyncImpl internal constructor(private val clientOptions: C
}
private val updateHandler: Handler =
- jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler)
+ jsonHandler(clientOptions.jsonMapper)
override fun update(
params: CustomerUpdateParams,
@@ -216,7 +216,7 @@ class CustomerServiceAsyncImpl internal constructor(private val clientOptions: C
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { updateHandler.handle(it) }
.also {
@@ -230,7 +230,6 @@ class CustomerServiceAsyncImpl internal constructor(private val clientOptions: C
private val listHandler: Handler =
jsonHandler(clientOptions.jsonMapper)
- .withErrorHandler(errorHandler)
override fun list(
params: CustomerListParams,
@@ -247,7 +246,7 @@ class CustomerServiceAsyncImpl internal constructor(private val clientOptions: C
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { listHandler.handle(it) }
.also {
@@ -267,7 +266,7 @@ class CustomerServiceAsyncImpl internal constructor(private val clientOptions: C
}
}
- private val deleteHandler: Handler = emptyHandler().withErrorHandler(errorHandler)
+ private val deleteHandler: Handler = emptyHandler()
override fun delete(
params: CustomerDeleteParams,
@@ -288,12 +287,14 @@ class CustomerServiceAsyncImpl internal constructor(private val clientOptions: C
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable { response.use { deleteHandler.handle(it) } }
+ errorHandler.handle(response).parseable {
+ response.use { deleteHandler.handle(it) }
+ }
}
}
private val fetchHandler: Handler =
- jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler)
+ jsonHandler(clientOptions.jsonMapper)
override fun fetch(
params: CustomerFetchParams,
@@ -313,7 +314,7 @@ class CustomerServiceAsyncImpl internal constructor(private val clientOptions: C
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { fetchHandler.handle(it) }
.also {
@@ -326,7 +327,7 @@ class CustomerServiceAsyncImpl internal constructor(private val clientOptions: C
}
private val fetchByExternalIdHandler: Handler =
- jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler)
+ jsonHandler(clientOptions.jsonMapper)
override fun fetchByExternalId(
params: CustomerFetchByExternalIdParams,
@@ -346,7 +347,7 @@ class CustomerServiceAsyncImpl internal constructor(private val clientOptions: C
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { fetchByExternalIdHandler.handle(it) }
.also {
@@ -358,8 +359,7 @@ class CustomerServiceAsyncImpl internal constructor(private val clientOptions: C
}
}
- private val syncPaymentMethodsFromGatewayHandler: Handler =
- emptyHandler().withErrorHandler(errorHandler)
+ private val syncPaymentMethodsFromGatewayHandler: Handler = emptyHandler()
override fun syncPaymentMethodsFromGateway(
params: CustomerSyncPaymentMethodsFromGatewayParams,
@@ -384,14 +384,14 @@ class CustomerServiceAsyncImpl internal constructor(private val clientOptions: C
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response.use { syncPaymentMethodsFromGatewayHandler.handle(it) }
}
}
}
private val syncPaymentMethodsFromGatewayByExternalCustomerIdHandler: Handler =
- emptyHandler().withErrorHandler(errorHandler)
+ emptyHandler()
override fun syncPaymentMethodsFromGatewayByExternalCustomerId(
params: CustomerSyncPaymentMethodsFromGatewayByExternalCustomerIdParams,
@@ -417,7 +417,7 @@ class CustomerServiceAsyncImpl internal constructor(private val clientOptions: C
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response.use {
syncPaymentMethodsFromGatewayByExternalCustomerIdHandler.handle(it)
}
@@ -426,7 +426,7 @@ class CustomerServiceAsyncImpl internal constructor(private val clientOptions: C
}
private val updateByExternalIdHandler: Handler =
- jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler)
+ jsonHandler(clientOptions.jsonMapper)
override fun updateByExternalId(
params: CustomerUpdateByExternalIdParams,
@@ -447,7 +447,7 @@ class CustomerServiceAsyncImpl internal constructor(private val clientOptions: C
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { updateByExternalIdHandler.handle(it) }
.also {
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/DimensionalPriceGroupServiceAsyncImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/DimensionalPriceGroupServiceAsyncImpl.kt
index 80c26820a..3566c6472 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/DimensionalPriceGroupServiceAsyncImpl.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/DimensionalPriceGroupServiceAsyncImpl.kt
@@ -3,14 +3,14 @@
package com.withorb.api.services.async
import com.withorb.api.core.ClientOptions
-import com.withorb.api.core.JsonValue
import com.withorb.api.core.RequestOptions
import com.withorb.api.core.checkRequired
+import com.withorb.api.core.handlers.errorBodyHandler
import com.withorb.api.core.handlers.errorHandler
import com.withorb.api.core.handlers.jsonHandler
-import com.withorb.api.core.handlers.withErrorHandler
import com.withorb.api.core.http.HttpMethod
import com.withorb.api.core.http.HttpRequest
+import com.withorb.api.core.http.HttpResponse
import com.withorb.api.core.http.HttpResponse.Handler
import com.withorb.api.core.http.HttpResponseFor
import com.withorb.api.core.http.json
@@ -77,7 +77,8 @@ internal constructor(private val clientOptions: ClientOptions) : DimensionalPric
class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) :
DimensionalPriceGroupServiceAsync.WithRawResponse {
- private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper)
+ private val errorHandler: Handler =
+ errorHandler(errorBodyHandler(clientOptions.jsonMapper))
private val externalDimensionalPriceGroupId:
ExternalDimensionalPriceGroupIdServiceAsync.WithRawResponse by lazy {
@@ -97,7 +98,6 @@ internal constructor(private val clientOptions: ClientOptions) : DimensionalPric
private val createHandler: Handler =
jsonHandler(clientOptions.jsonMapper)
- .withErrorHandler(errorHandler)
override fun create(
params: DimensionalPriceGroupCreateParams,
@@ -115,7 +115,7 @@ internal constructor(private val clientOptions: ClientOptions) : DimensionalPric
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { createHandler.handle(it) }
.also {
@@ -129,7 +129,6 @@ internal constructor(private val clientOptions: ClientOptions) : DimensionalPric
private val retrieveHandler: Handler =
jsonHandler(clientOptions.jsonMapper)
- .withErrorHandler(errorHandler)
override fun retrieve(
params: DimensionalPriceGroupRetrieveParams,
@@ -149,7 +148,7 @@ internal constructor(private val clientOptions: ClientOptions) : DimensionalPric
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { retrieveHandler.handle(it) }
.also {
@@ -163,7 +162,6 @@ internal constructor(private val clientOptions: ClientOptions) : DimensionalPric
private val listHandler: Handler =
jsonHandler(clientOptions.jsonMapper)
- .withErrorHandler(errorHandler)
override fun list(
params: DimensionalPriceGroupListParams,
@@ -180,7 +178,7 @@ internal constructor(private val clientOptions: ClientOptions) : DimensionalPric
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { listHandler.handle(it) }
.also {
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/EventServiceAsyncImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/EventServiceAsyncImpl.kt
index 397718b57..782512a84 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/EventServiceAsyncImpl.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/EventServiceAsyncImpl.kt
@@ -3,14 +3,14 @@
package com.withorb.api.services.async
import com.withorb.api.core.ClientOptions
-import com.withorb.api.core.JsonValue
import com.withorb.api.core.RequestOptions
import com.withorb.api.core.checkRequired
+import com.withorb.api.core.handlers.errorBodyHandler
import com.withorb.api.core.handlers.errorHandler
import com.withorb.api.core.handlers.jsonHandler
-import com.withorb.api.core.handlers.withErrorHandler
import com.withorb.api.core.http.HttpMethod
import com.withorb.api.core.http.HttpRequest
+import com.withorb.api.core.http.HttpResponse
import com.withorb.api.core.http.HttpResponse.Handler
import com.withorb.api.core.http.HttpResponseFor
import com.withorb.api.core.http.json
@@ -83,7 +83,8 @@ class EventServiceAsyncImpl internal constructor(private val clientOptions: Clie
class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) :
EventServiceAsync.WithRawResponse {
- private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper)
+ private val errorHandler: Handler =
+ errorHandler(errorBodyHandler(clientOptions.jsonMapper))
private val backfills: BackfillServiceAsync.WithRawResponse by lazy {
BackfillServiceAsyncImpl.WithRawResponseImpl(clientOptions)
@@ -106,7 +107,6 @@ class EventServiceAsyncImpl internal constructor(private val clientOptions: Clie
private val updateHandler: Handler =
jsonHandler(clientOptions.jsonMapper)
- .withErrorHandler(errorHandler)
override fun update(
params: EventUpdateParams,
@@ -127,7 +127,7 @@ class EventServiceAsyncImpl internal constructor(private val clientOptions: Clie
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { updateHandler.handle(it) }
.also {
@@ -141,7 +141,6 @@ class EventServiceAsyncImpl internal constructor(private val clientOptions: Clie
private val deprecateHandler: Handler =
jsonHandler(clientOptions.jsonMapper)
- .withErrorHandler(errorHandler)
override fun deprecate(
params: EventDeprecateParams,
@@ -162,7 +161,7 @@ class EventServiceAsyncImpl internal constructor(private val clientOptions: Clie
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { deprecateHandler.handle(it) }
.also {
@@ -176,7 +175,6 @@ class EventServiceAsyncImpl internal constructor(private val clientOptions: Clie
private val ingestHandler: Handler =
jsonHandler(clientOptions.jsonMapper)
- .withErrorHandler(errorHandler)
override fun ingest(
params: EventIngestParams,
@@ -194,7 +192,7 @@ class EventServiceAsyncImpl internal constructor(private val clientOptions: Clie
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { ingestHandler.handle(it) }
.also {
@@ -208,7 +206,6 @@ class EventServiceAsyncImpl internal constructor(private val clientOptions: Clie
private val searchHandler: Handler =
jsonHandler(clientOptions.jsonMapper)
- .withErrorHandler(errorHandler)
override fun search(
params: EventSearchParams,
@@ -226,7 +223,7 @@ class EventServiceAsyncImpl internal constructor(private val clientOptions: Clie
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { searchHandler.handle(it) }
.also {
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/InvoiceLineItemServiceAsyncImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/InvoiceLineItemServiceAsyncImpl.kt
index 5993e2551..58ac0b84d 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/InvoiceLineItemServiceAsyncImpl.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/InvoiceLineItemServiceAsyncImpl.kt
@@ -3,13 +3,13 @@
package com.withorb.api.services.async
import com.withorb.api.core.ClientOptions
-import com.withorb.api.core.JsonValue
import com.withorb.api.core.RequestOptions
+import com.withorb.api.core.handlers.errorBodyHandler
import com.withorb.api.core.handlers.errorHandler
import com.withorb.api.core.handlers.jsonHandler
-import com.withorb.api.core.handlers.withErrorHandler
import com.withorb.api.core.http.HttpMethod
import com.withorb.api.core.http.HttpRequest
+import com.withorb.api.core.http.HttpResponse
import com.withorb.api.core.http.HttpResponse.Handler
import com.withorb.api.core.http.HttpResponseFor
import com.withorb.api.core.http.json
@@ -44,7 +44,8 @@ internal constructor(private val clientOptions: ClientOptions) : InvoiceLineItem
class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) :
InvoiceLineItemServiceAsync.WithRawResponse {
- private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper)
+ private val errorHandler: Handler =
+ errorHandler(errorBodyHandler(clientOptions.jsonMapper))
override fun withOptions(
modifier: Consumer
@@ -55,7 +56,6 @@ internal constructor(private val clientOptions: ClientOptions) : InvoiceLineItem
private val createHandler: Handler =
jsonHandler(clientOptions.jsonMapper)
- .withErrorHandler(errorHandler)
override fun create(
params: InvoiceLineItemCreateParams,
@@ -73,7 +73,7 @@ internal constructor(private val clientOptions: ClientOptions) : InvoiceLineItem
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { createHandler.handle(it) }
.also {
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/InvoiceServiceAsyncImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/InvoiceServiceAsyncImpl.kt
index 3fceafccb..b3504b524 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/InvoiceServiceAsyncImpl.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/InvoiceServiceAsyncImpl.kt
@@ -3,14 +3,14 @@
package com.withorb.api.services.async
import com.withorb.api.core.ClientOptions
-import com.withorb.api.core.JsonValue
import com.withorb.api.core.RequestOptions
import com.withorb.api.core.checkRequired
+import com.withorb.api.core.handlers.errorBodyHandler
import com.withorb.api.core.handlers.errorHandler
import com.withorb.api.core.handlers.jsonHandler
-import com.withorb.api.core.handlers.withErrorHandler
import com.withorb.api.core.http.HttpMethod
import com.withorb.api.core.http.HttpRequest
+import com.withorb.api.core.http.HttpResponse
import com.withorb.api.core.http.HttpResponse.Handler
import com.withorb.api.core.http.HttpResponseFor
import com.withorb.api.core.http.json
@@ -111,7 +111,8 @@ class InvoiceServiceAsyncImpl internal constructor(private val clientOptions: Cl
class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) :
InvoiceServiceAsync.WithRawResponse {
- private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper)
+ private val errorHandler: Handler =
+ errorHandler(errorBodyHandler(clientOptions.jsonMapper))
override fun withOptions(
modifier: Consumer
@@ -120,8 +121,7 @@ class InvoiceServiceAsyncImpl internal constructor(private val clientOptions: Cl
clientOptions.toBuilder().apply(modifier::accept).build()
)
- private val createHandler: Handler =
- jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler)
+ private val createHandler: Handler = jsonHandler(clientOptions.jsonMapper)
override fun create(
params: InvoiceCreateParams,
@@ -139,7 +139,7 @@ class InvoiceServiceAsyncImpl internal constructor(private val clientOptions: Cl
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { createHandler.handle(it) }
.also {
@@ -151,8 +151,7 @@ class InvoiceServiceAsyncImpl internal constructor(private val clientOptions: Cl
}
}
- private val updateHandler: Handler =
- jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler)
+ private val updateHandler: Handler = jsonHandler(clientOptions.jsonMapper)
override fun update(
params: InvoiceUpdateParams,
@@ -173,7 +172,7 @@ class InvoiceServiceAsyncImpl internal constructor(private val clientOptions: Cl
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { updateHandler.handle(it) }
.also {
@@ -187,7 +186,6 @@ class InvoiceServiceAsyncImpl internal constructor(private val clientOptions: Cl
private val listHandler: Handler =
jsonHandler(clientOptions.jsonMapper)
- .withErrorHandler(errorHandler)
override fun list(
params: InvoiceListParams,
@@ -204,7 +202,7 @@ class InvoiceServiceAsyncImpl internal constructor(private val clientOptions: Cl
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { listHandler.handle(it) }
.also {
@@ -224,8 +222,7 @@ class InvoiceServiceAsyncImpl internal constructor(private val clientOptions: Cl
}
}
- private val fetchHandler: Handler =
- jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler)
+ private val fetchHandler: Handler = jsonHandler(clientOptions.jsonMapper)
override fun fetch(
params: InvoiceFetchParams,
@@ -245,7 +242,7 @@ class InvoiceServiceAsyncImpl internal constructor(private val clientOptions: Cl
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { fetchHandler.handle(it) }
.also {
@@ -259,7 +256,6 @@ class InvoiceServiceAsyncImpl internal constructor(private val clientOptions: Cl
private val fetchUpcomingHandler: Handler =
jsonHandler(clientOptions.jsonMapper)
- .withErrorHandler(errorHandler)
override fun fetchUpcoming(
params: InvoiceFetchUpcomingParams,
@@ -276,7 +272,7 @@ class InvoiceServiceAsyncImpl internal constructor(private val clientOptions: Cl
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { fetchUpcomingHandler.handle(it) }
.also {
@@ -288,8 +284,7 @@ class InvoiceServiceAsyncImpl internal constructor(private val clientOptions: Cl
}
}
- private val issueHandler: Handler =
- jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler)
+ private val issueHandler: Handler = jsonHandler(clientOptions.jsonMapper)
override fun issue(
params: InvoiceIssueParams,
@@ -310,7 +305,7 @@ class InvoiceServiceAsyncImpl internal constructor(private val clientOptions: Cl
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { issueHandler.handle(it) }
.also {
@@ -323,7 +318,7 @@ class InvoiceServiceAsyncImpl internal constructor(private val clientOptions: Cl
}
private val markPaidHandler: Handler =
- jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler)
+ jsonHandler(clientOptions.jsonMapper)
override fun markPaid(
params: InvoiceMarkPaidParams,
@@ -344,7 +339,7 @@ class InvoiceServiceAsyncImpl internal constructor(private val clientOptions: Cl
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { markPaidHandler.handle(it) }
.also {
@@ -356,8 +351,7 @@ class InvoiceServiceAsyncImpl internal constructor(private val clientOptions: Cl
}
}
- private val payHandler: Handler =
- jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler)
+ private val payHandler: Handler = jsonHandler(clientOptions.jsonMapper)
override fun pay(
params: InvoicePayParams,
@@ -378,7 +372,7 @@ class InvoiceServiceAsyncImpl internal constructor(private val clientOptions: Cl
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { payHandler.handle(it) }
.also {
@@ -391,7 +385,7 @@ class InvoiceServiceAsyncImpl internal constructor(private val clientOptions: Cl
}
private val voidInvoiceHandler: Handler =
- jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler)
+ jsonHandler(clientOptions.jsonMapper)
override fun voidInvoice(
params: InvoiceVoidInvoiceParams,
@@ -412,7 +406,7 @@ class InvoiceServiceAsyncImpl internal constructor(private val clientOptions: Cl
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { voidInvoiceHandler.handle(it) }
.also {
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/ItemServiceAsyncImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/ItemServiceAsyncImpl.kt
index a8c776b0c..d17818542 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/ItemServiceAsyncImpl.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/ItemServiceAsyncImpl.kt
@@ -3,14 +3,14 @@
package com.withorb.api.services.async
import com.withorb.api.core.ClientOptions
-import com.withorb.api.core.JsonValue
import com.withorb.api.core.RequestOptions
import com.withorb.api.core.checkRequired
+import com.withorb.api.core.handlers.errorBodyHandler
import com.withorb.api.core.handlers.errorHandler
import com.withorb.api.core.handlers.jsonHandler
-import com.withorb.api.core.handlers.withErrorHandler
import com.withorb.api.core.http.HttpMethod
import com.withorb.api.core.http.HttpRequest
+import com.withorb.api.core.http.HttpResponse
import com.withorb.api.core.http.HttpResponse.Handler
import com.withorb.api.core.http.HttpResponseFor
import com.withorb.api.core.http.json
@@ -78,7 +78,8 @@ class ItemServiceAsyncImpl internal constructor(private val clientOptions: Clien
class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) :
ItemServiceAsync.WithRawResponse {
- private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper)
+ private val errorHandler: Handler =
+ errorHandler(errorBodyHandler(clientOptions.jsonMapper))
override fun withOptions(
modifier: Consumer
@@ -87,8 +88,7 @@ class ItemServiceAsyncImpl internal constructor(private val clientOptions: Clien
clientOptions.toBuilder().apply(modifier::accept).build()
)
- private val createHandler: Handler- =
- jsonHandler
- (clientOptions.jsonMapper).withErrorHandler(errorHandler)
+ private val createHandler: Handler
- = jsonHandler
- (clientOptions.jsonMapper)
override fun create(
params: ItemCreateParams,
@@ -106,7 +106,7 @@ class ItemServiceAsyncImpl internal constructor(private val clientOptions: Clien
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { createHandler.handle(it) }
.also {
@@ -118,8 +118,7 @@ class ItemServiceAsyncImpl internal constructor(private val clientOptions: Clien
}
}
- private val updateHandler: Handler
- =
- jsonHandler
- (clientOptions.jsonMapper).withErrorHandler(errorHandler)
+ private val updateHandler: Handler
- = jsonHandler
- (clientOptions.jsonMapper)
override fun update(
params: ItemUpdateParams,
@@ -140,7 +139,7 @@ class ItemServiceAsyncImpl internal constructor(private val clientOptions: Clien
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { updateHandler.handle(it) }
.also {
@@ -154,7 +153,6 @@ class ItemServiceAsyncImpl internal constructor(private val clientOptions: Clien
private val listHandler: Handler =
jsonHandler(clientOptions.jsonMapper)
- .withErrorHandler(errorHandler)
override fun list(
params: ItemListParams,
@@ -171,7 +169,7 @@ class ItemServiceAsyncImpl internal constructor(private val clientOptions: Clien
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { listHandler.handle(it) }
.also {
@@ -191,8 +189,7 @@ class ItemServiceAsyncImpl internal constructor(private val clientOptions: Clien
}
}
- private val archiveHandler: Handler
- =
- jsonHandler
- (clientOptions.jsonMapper).withErrorHandler(errorHandler)
+ private val archiveHandler: Handler
- = jsonHandler
- (clientOptions.jsonMapper)
override fun archive(
params: ItemArchiveParams,
@@ -213,7 +210,7 @@ class ItemServiceAsyncImpl internal constructor(private val clientOptions: Clien
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { archiveHandler.handle(it) }
.also {
@@ -225,8 +222,7 @@ class ItemServiceAsyncImpl internal constructor(private val clientOptions: Clien
}
}
- private val fetchHandler: Handler
- =
- jsonHandler
- (clientOptions.jsonMapper).withErrorHandler(errorHandler)
+ private val fetchHandler: Handler
- = jsonHandler
- (clientOptions.jsonMapper)
override fun fetch(
params: ItemFetchParams,
@@ -246,7 +242,7 @@ class ItemServiceAsyncImpl internal constructor(private val clientOptions: Clien
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { fetchHandler.handle(it) }
.also {
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/MetricServiceAsyncImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/MetricServiceAsyncImpl.kt
index ba202affb..756da69a9 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/MetricServiceAsyncImpl.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/MetricServiceAsyncImpl.kt
@@ -3,14 +3,14 @@
package com.withorb.api.services.async
import com.withorb.api.core.ClientOptions
-import com.withorb.api.core.JsonValue
import com.withorb.api.core.RequestOptions
import com.withorb.api.core.checkRequired
+import com.withorb.api.core.handlers.errorBodyHandler
import com.withorb.api.core.handlers.errorHandler
import com.withorb.api.core.handlers.jsonHandler
-import com.withorb.api.core.handlers.withErrorHandler
import com.withorb.api.core.http.HttpMethod
import com.withorb.api.core.http.HttpRequest
+import com.withorb.api.core.http.HttpResponse
import com.withorb.api.core.http.HttpResponse.Handler
import com.withorb.api.core.http.HttpResponseFor
import com.withorb.api.core.http.json
@@ -70,7 +70,8 @@ class MetricServiceAsyncImpl internal constructor(private val clientOptions: Cli
class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) :
MetricServiceAsync.WithRawResponse {
- private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper)
+ private val errorHandler: Handler =
+ errorHandler(errorBodyHandler(clientOptions.jsonMapper))
override fun withOptions(
modifier: Consumer
@@ -80,7 +81,7 @@ class MetricServiceAsyncImpl internal constructor(private val clientOptions: Cli
)
private val createHandler: Handler =
- jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler)
+ jsonHandler(clientOptions.jsonMapper)
override fun create(
params: MetricCreateParams,
@@ -98,7 +99,7 @@ class MetricServiceAsyncImpl internal constructor(private val clientOptions: Cli
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { createHandler.handle(it) }
.also {
@@ -111,7 +112,7 @@ class MetricServiceAsyncImpl internal constructor(private val clientOptions: Cli
}
private val updateHandler: Handler =
- jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler)
+ jsonHandler(clientOptions.jsonMapper)
override fun update(
params: MetricUpdateParams,
@@ -132,7 +133,7 @@ class MetricServiceAsyncImpl internal constructor(private val clientOptions: Cli
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { updateHandler.handle(it) }
.also {
@@ -146,7 +147,6 @@ class MetricServiceAsyncImpl internal constructor(private val clientOptions: Cli
private val listHandler: Handler =
jsonHandler(clientOptions.jsonMapper)
- .withErrorHandler(errorHandler)
override fun list(
params: MetricListParams,
@@ -163,7 +163,7 @@ class MetricServiceAsyncImpl internal constructor(private val clientOptions: Cli
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { listHandler.handle(it) }
.also {
@@ -184,7 +184,7 @@ class MetricServiceAsyncImpl internal constructor(private val clientOptions: Cli
}
private val fetchHandler: Handler =
- jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler)
+ jsonHandler(clientOptions.jsonMapper)
override fun fetch(
params: MetricFetchParams,
@@ -204,7 +204,7 @@ class MetricServiceAsyncImpl internal constructor(private val clientOptions: Cli
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { fetchHandler.handle(it) }
.also {
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/PlanServiceAsyncImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/PlanServiceAsyncImpl.kt
index f57206eef..4e5cb6212 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/PlanServiceAsyncImpl.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/PlanServiceAsyncImpl.kt
@@ -3,14 +3,14 @@
package com.withorb.api.services.async
import com.withorb.api.core.ClientOptions
-import com.withorb.api.core.JsonValue
import com.withorb.api.core.RequestOptions
import com.withorb.api.core.checkRequired
+import com.withorb.api.core.handlers.errorBodyHandler
import com.withorb.api.core.handlers.errorHandler
import com.withorb.api.core.handlers.jsonHandler
-import com.withorb.api.core.handlers.withErrorHandler
import com.withorb.api.core.http.HttpMethod
import com.withorb.api.core.http.HttpRequest
+import com.withorb.api.core.http.HttpResponse
import com.withorb.api.core.http.HttpResponse.Handler
import com.withorb.api.core.http.HttpResponseFor
import com.withorb.api.core.http.json
@@ -78,7 +78,8 @@ class PlanServiceAsyncImpl internal constructor(private val clientOptions: Clien
class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) :
PlanServiceAsync.WithRawResponse {
- private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper)
+ private val errorHandler: Handler =
+ errorHandler(errorBodyHandler(clientOptions.jsonMapper))
private val externalPlanId: ExternalPlanIdServiceAsync.WithRawResponse by lazy {
ExternalPlanIdServiceAsyncImpl.WithRawResponseImpl(clientOptions)
@@ -93,8 +94,7 @@ class PlanServiceAsyncImpl internal constructor(private val clientOptions: Clien
override fun externalPlanId(): ExternalPlanIdServiceAsync.WithRawResponse = externalPlanId
- private val createHandler: Handler =
- jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler)
+ private val createHandler: Handler = jsonHandler(clientOptions.jsonMapper)
override fun create(
params: PlanCreateParams,
@@ -112,7 +112,7 @@ class PlanServiceAsyncImpl internal constructor(private val clientOptions: Clien
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { createHandler.handle(it) }
.also {
@@ -124,8 +124,7 @@ class PlanServiceAsyncImpl internal constructor(private val clientOptions: Clien
}
}
- private val updateHandler: Handler =
- jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler)
+ private val updateHandler: Handler = jsonHandler(clientOptions.jsonMapper)
override fun update(
params: PlanUpdateParams,
@@ -146,7 +145,7 @@ class PlanServiceAsyncImpl internal constructor(private val clientOptions: Clien
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { updateHandler.handle(it) }
.also {
@@ -160,7 +159,6 @@ class PlanServiceAsyncImpl internal constructor(private val clientOptions: Clien
private val listHandler: Handler =
jsonHandler(clientOptions.jsonMapper)
- .withErrorHandler(errorHandler)
override fun list(
params: PlanListParams,
@@ -177,7 +175,7 @@ class PlanServiceAsyncImpl internal constructor(private val clientOptions: Clien
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { listHandler.handle(it) }
.also {
@@ -197,8 +195,7 @@ class PlanServiceAsyncImpl internal constructor(private val clientOptions: Clien
}
}
- private val fetchHandler: Handler =
- jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler)
+ private val fetchHandler: Handler = jsonHandler(clientOptions.jsonMapper)
override fun fetch(
params: PlanFetchParams,
@@ -218,7 +215,7 @@ class PlanServiceAsyncImpl internal constructor(private val clientOptions: Clien
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { fetchHandler.handle(it) }
.also {
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/PriceServiceAsyncImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/PriceServiceAsyncImpl.kt
index b0b0530da..e7573d2e5 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/PriceServiceAsyncImpl.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/PriceServiceAsyncImpl.kt
@@ -3,14 +3,14 @@
package com.withorb.api.services.async
import com.withorb.api.core.ClientOptions
-import com.withorb.api.core.JsonValue
import com.withorb.api.core.RequestOptions
import com.withorb.api.core.checkRequired
+import com.withorb.api.core.handlers.errorBodyHandler
import com.withorb.api.core.handlers.errorHandler
import com.withorb.api.core.handlers.jsonHandler
-import com.withorb.api.core.handlers.withErrorHandler
import com.withorb.api.core.http.HttpMethod
import com.withorb.api.core.http.HttpRequest
+import com.withorb.api.core.http.HttpResponse
import com.withorb.api.core.http.HttpResponse.Handler
import com.withorb.api.core.http.HttpResponseFor
import com.withorb.api.core.http.json
@@ -105,7 +105,8 @@ class PriceServiceAsyncImpl internal constructor(private val clientOptions: Clie
class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) :
PriceServiceAsync.WithRawResponse {
- private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper)
+ private val errorHandler: Handler =
+ errorHandler(errorBodyHandler(clientOptions.jsonMapper))
private val externalPriceId: ExternalPriceIdServiceAsync.WithRawResponse by lazy {
ExternalPriceIdServiceAsyncImpl.WithRawResponseImpl(clientOptions)
@@ -121,8 +122,7 @@ class PriceServiceAsyncImpl internal constructor(private val clientOptions: Clie
override fun externalPriceId(): ExternalPriceIdServiceAsync.WithRawResponse =
externalPriceId
- private val createHandler: Handler =
- jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler)
+ private val createHandler: Handler = jsonHandler(clientOptions.jsonMapper)
override fun create(
params: PriceCreateParams,
@@ -140,7 +140,7 @@ class PriceServiceAsyncImpl internal constructor(private val clientOptions: Clie
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { createHandler.handle(it) }
.also {
@@ -152,8 +152,7 @@ class PriceServiceAsyncImpl internal constructor(private val clientOptions: Clie
}
}
- private val updateHandler: Handler =
- jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler)
+ private val updateHandler: Handler = jsonHandler(clientOptions.jsonMapper)
override fun update(
params: PriceUpdateParams,
@@ -174,7 +173,7 @@ class PriceServiceAsyncImpl internal constructor(private val clientOptions: Clie
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { updateHandler.handle(it) }
.also {
@@ -188,7 +187,6 @@ class PriceServiceAsyncImpl internal constructor(private val clientOptions: Clie
private val listHandler: Handler =
jsonHandler(clientOptions.jsonMapper)
- .withErrorHandler(errorHandler)
override fun list(
params: PriceListParams,
@@ -205,7 +203,7 @@ class PriceServiceAsyncImpl internal constructor(private val clientOptions: Clie
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { listHandler.handle(it) }
.also {
@@ -227,7 +225,6 @@ class PriceServiceAsyncImpl internal constructor(private val clientOptions: Clie
private val evaluateHandler: Handler =
jsonHandler(clientOptions.jsonMapper)
- .withErrorHandler(errorHandler)
override fun evaluate(
params: PriceEvaluateParams,
@@ -248,7 +245,7 @@ class PriceServiceAsyncImpl internal constructor(private val clientOptions: Clie
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { evaluateHandler.handle(it) }
.also {
@@ -262,7 +259,6 @@ class PriceServiceAsyncImpl internal constructor(private val clientOptions: Clie
private val evaluateMultipleHandler: Handler =
jsonHandler(clientOptions.jsonMapper)
- .withErrorHandler(errorHandler)
override fun evaluateMultiple(
params: PriceEvaluateMultipleParams,
@@ -280,7 +276,7 @@ class PriceServiceAsyncImpl internal constructor(private val clientOptions: Clie
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { evaluateMultipleHandler.handle(it) }
.also {
@@ -294,7 +290,6 @@ class PriceServiceAsyncImpl internal constructor(private val clientOptions: Clie
private val evaluatePreviewEventsHandler: Handler =
jsonHandler(clientOptions.jsonMapper)
- .withErrorHandler(errorHandler)
override fun evaluatePreviewEvents(
params: PriceEvaluatePreviewEventsParams,
@@ -312,7 +307,7 @@ class PriceServiceAsyncImpl internal constructor(private val clientOptions: Clie
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { evaluatePreviewEventsHandler.handle(it) }
.also {
@@ -324,8 +319,7 @@ class PriceServiceAsyncImpl internal constructor(private val clientOptions: Clie
}
}
- private val fetchHandler: Handler =
- jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler)
+ private val fetchHandler: Handler = jsonHandler(clientOptions.jsonMapper)
override fun fetch(
params: PriceFetchParams,
@@ -345,7 +339,7 @@ class PriceServiceAsyncImpl internal constructor(private val clientOptions: Clie
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { fetchHandler.handle(it) }
.also {
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/SubscriptionChangeServiceAsyncImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/SubscriptionChangeServiceAsyncImpl.kt
index 41b345768..d58f5a87e 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/SubscriptionChangeServiceAsyncImpl.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/SubscriptionChangeServiceAsyncImpl.kt
@@ -3,14 +3,14 @@
package com.withorb.api.services.async
import com.withorb.api.core.ClientOptions
-import com.withorb.api.core.JsonValue
import com.withorb.api.core.RequestOptions
import com.withorb.api.core.checkRequired
+import com.withorb.api.core.handlers.errorBodyHandler
import com.withorb.api.core.handlers.errorHandler
import com.withorb.api.core.handlers.jsonHandler
-import com.withorb.api.core.handlers.withErrorHandler
import com.withorb.api.core.http.HttpMethod
import com.withorb.api.core.http.HttpRequest
+import com.withorb.api.core.http.HttpResponse
import com.withorb.api.core.http.HttpResponse.Handler
import com.withorb.api.core.http.HttpResponseFor
import com.withorb.api.core.http.json
@@ -66,7 +66,8 @@ internal constructor(private val clientOptions: ClientOptions) : SubscriptionCha
class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) :
SubscriptionChangeServiceAsync.WithRawResponse {
- private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper)
+ private val errorHandler: Handler =
+ errorHandler(errorBodyHandler(clientOptions.jsonMapper))
override fun withOptions(
modifier: Consumer
@@ -77,7 +78,6 @@ internal constructor(private val clientOptions: ClientOptions) : SubscriptionCha
private val retrieveHandler: Handler =
jsonHandler(clientOptions.jsonMapper)
- .withErrorHandler(errorHandler)
override fun retrieve(
params: SubscriptionChangeRetrieveParams,
@@ -97,7 +97,7 @@ internal constructor(private val clientOptions: ClientOptions) : SubscriptionCha
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { retrieveHandler.handle(it) }
.also {
@@ -111,7 +111,6 @@ internal constructor(private val clientOptions: ClientOptions) : SubscriptionCha
private val applyHandler: Handler =
jsonHandler(clientOptions.jsonMapper)
- .withErrorHandler(errorHandler)
override fun apply(
params: SubscriptionChangeApplyParams,
@@ -132,7 +131,7 @@ internal constructor(private val clientOptions: ClientOptions) : SubscriptionCha
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { applyHandler.handle(it) }
.also {
@@ -146,7 +145,6 @@ internal constructor(private val clientOptions: ClientOptions) : SubscriptionCha
private val cancelHandler: Handler =
jsonHandler(clientOptions.jsonMapper)
- .withErrorHandler(errorHandler)
override fun cancel(
params: SubscriptionChangeCancelParams,
@@ -167,7 +165,7 @@ internal constructor(private val clientOptions: ClientOptions) : SubscriptionCha
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { cancelHandler.handle(it) }
.also {
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/SubscriptionServiceAsyncImpl.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/SubscriptionServiceAsyncImpl.kt
index 0ea0f6af7..151dc1fbe 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/SubscriptionServiceAsyncImpl.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/SubscriptionServiceAsyncImpl.kt
@@ -3,14 +3,14 @@
package com.withorb.api.services.async
import com.withorb.api.core.ClientOptions
-import com.withorb.api.core.JsonValue
import com.withorb.api.core.RequestOptions
import com.withorb.api.core.checkRequired
+import com.withorb.api.core.handlers.errorBodyHandler
import com.withorb.api.core.handlers.errorHandler
import com.withorb.api.core.handlers.jsonHandler
-import com.withorb.api.core.handlers.withErrorHandler
import com.withorb.api.core.http.HttpMethod
import com.withorb.api.core.http.HttpRequest
+import com.withorb.api.core.http.HttpResponse
import com.withorb.api.core.http.HttpResponse.Handler
import com.withorb.api.core.http.HttpResponseFor
import com.withorb.api.core.http.json
@@ -183,7 +183,8 @@ class SubscriptionServiceAsyncImpl internal constructor(private val clientOption
class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) :
SubscriptionServiceAsync.WithRawResponse {
- private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper)
+ private val errorHandler: Handler =
+ errorHandler(errorBodyHandler(clientOptions.jsonMapper))
override fun withOptions(
modifier: Consumer
@@ -194,7 +195,6 @@ class SubscriptionServiceAsyncImpl internal constructor(private val clientOption
private val createHandler: Handler =
jsonHandler(clientOptions.jsonMapper)
- .withErrorHandler(errorHandler)
override fun create(
params: SubscriptionCreateParams,
@@ -212,7 +212,7 @@ class SubscriptionServiceAsyncImpl internal constructor(private val clientOption
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { createHandler.handle(it) }
.also {
@@ -225,7 +225,7 @@ class SubscriptionServiceAsyncImpl internal constructor(private val clientOption
}
private val updateHandler: Handler =
- jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler)
+ jsonHandler(clientOptions.jsonMapper)
override fun update(
params: SubscriptionUpdateParams,
@@ -246,7 +246,7 @@ class SubscriptionServiceAsyncImpl internal constructor(private val clientOption
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { updateHandler.handle(it) }
.also {
@@ -259,7 +259,7 @@ class SubscriptionServiceAsyncImpl internal constructor(private val clientOption
}
private val listHandler: Handler =
- jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler)
+ jsonHandler(clientOptions.jsonMapper)
override fun list(
params: SubscriptionListParams,
@@ -276,7 +276,7 @@ class SubscriptionServiceAsyncImpl internal constructor(private val clientOption
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { listHandler.handle(it) }
.also {
@@ -298,7 +298,6 @@ class SubscriptionServiceAsyncImpl internal constructor(private val clientOption
private val cancelHandler: Handler