Add error handling to re-throw Stripe POST errors.

This commit is contained in:
Alex Hart
2022-12-12 15:57:05 -04:00
parent e6f28c6cdd
commit 599caee229

View File

@@ -135,6 +135,8 @@ class StripeApi(
objectMapper.readValue(it.body()!!.string())
} catch (e: InvalidDefinitionException) {
throw StripeError.FailedToParseSetupIntentResponseError(e)
} catch (e: StripeError.PostError) {
throw e
} catch (e: Exception) {
throw StripeError.FailedToParseSetupIntentResponseError(null)
}
@@ -153,6 +155,8 @@ class StripeApi(
objectMapper.readValue(it.body()!!.string())
} catch (e: InvalidDefinitionException) {
throw StripeError.FailedToParsePaymentIntentResponseError(e)
} catch (e: StripeError.PostError) {
throw e
} catch (e: Exception) {
throw StripeError.FailedToParsePaymentIntentResponseError(null)
}