Summary
TypeSafeApiException.fromResponse maps 400/401/403/404/422/429/5xx to a status-specific exception, but 402 (Payment Required) and 413 (Payload Too Large) fall through to the generic TypeSafeApiException, same as an unmapped status like 418.
Why these two
Both are documented, actionable API responses (out-of-credits, request-too-large), not arbitrary statuses — same reasoning that gave 400/401/403/404/422/429 their own types. The JS SDK has the identical gap, reported today: typesafe-ai/typesafe-sdk-js#13.
Location
https://github.com/Premo-Cloud/typesafe-sdk-java/blob/main/typesafe-sdk/src/main/java/io/github/premocloud/typesafe/TypeSafeApiException.java#L36-L46
Suggested fix
Add TypeSafePaymentRequiredException and TypeSafePayloadTooLargeException following the existing one-line subclasses (e.g. TypeSafeBadRequestException), and two more case arms in the switch. Neither status is in RetryPolicy.DEFAULT_HTTP_STATUSES, so no retry-behavior change.
Summary
TypeSafeApiException.fromResponsemaps 400/401/403/404/422/429/5xx to a status-specific exception, but 402 (Payment Required) and 413 (Payload Too Large) fall through to the genericTypeSafeApiException, same as an unmapped status like 418.Why these two
Both are documented, actionable API responses (out-of-credits, request-too-large), not arbitrary statuses — same reasoning that gave 400/401/403/404/422/429 their own types. The JS SDK has the identical gap, reported today: typesafe-ai/typesafe-sdk-js#13.
Location
https://github.com/Premo-Cloud/typesafe-sdk-java/blob/main/typesafe-sdk/src/main/java/io/github/premocloud/typesafe/TypeSafeApiException.java#L36-L46
Suggested fix
Add
TypeSafePaymentRequiredExceptionandTypeSafePayloadTooLargeExceptionfollowing the existing one-line subclasses (e.g.TypeSafeBadRequestException), and two morecasearms in the switch. Neither status is inRetryPolicy.DEFAULT_HTTP_STATUSES, so no retry-behavior change.