Sep31BadRequestException

class Sep31BadRequestException(message: String, val statusCode: Int = 400, val rawResponseBody: String? = null) : Sep31Exception

Exception thrown when the Receiving Anchor returns HTTP 400 Bad Request.

Indicates that the request was malformed or contained invalid parameters. The two domain-specific 400 subcases — customer_info_needed and transaction_info_needed — are dispatched to Sep31CustomerInfoNeededException and Sep31TransactionInfoNeededException respectively; this generic class covers every other 400 response.

Common causes:

  • Required request fields are missing

  • Request body JSON is malformed

  • Amount falls outside the asset's min/max limits

  • Unsupported asset or destination asset

  • Invalid or expired SEP-38 quote_id

  • sender_id or receiver_id references an unknown SEP-12 customer

Recovery actions:

  • Inspect message for the sanitized error returned by the anchor

  • Verify all required request parameters per the SEP-31 spec

  • Re-fetch the asset configuration via GET /info to confirm limits and supported funding methods

Example - Handle bad request:

try {
val response = sep31Service.postTransactions(request, jwt)
} catch (e: Sep31BadRequestException) {
println("Invalid request (HTTP ${e.statusCode}): ${e.message}")
}

See also:

Parameters

message

Sanitized error message extracted from the anchor response.

Constructors

Link copied to clipboard
constructor(message: String, statusCode: Int = 400, rawResponseBody: String? = null)

Properties

Link copied to clipboard
expect open val cause: Throwable?
Link copied to clipboard
expect open val message: String?
Link copied to clipboard

Anchor response body for local debugging — see the rawResponseBody convention on Sep31Exception. null when no body was captured.

Link copied to clipboard

The HTTP status code returned by the Receiving Anchor (always 400 for this exception).

Functions

Link copied to clipboard
open override fun toString(): String