Sep38Exception

open class Sep38Exception(message: String, cause: Throwable? = null) : Exception

Base exception class for SEP-38 Quote API errors.

All SEP-38-specific exceptions extend this class to enable unified error handling while providing specific error types for different failure scenarios.

This exception hierarchy allows applications to handle quote API errors at different levels:

  • Catch Sep38Exception for general quote API error handling

  • Catch specific subclasses for precise error recovery

Common error scenarios:

Example - General error handling:

try {
val quote = quoteService.postQuote(request, jwt)
} catch (e: Sep38BadRequestException) {
// Invalid request parameters
println("Bad request: ${e.message}")
} catch (e: Sep38PermissionDeniedException) {
// Authentication failed
println("Permission denied, please re-authenticate")
} catch (e: Sep38Exception) {
// Other quote API errors
println("Quote error: ${e.message}")
}

Example - Specific error recovery:

try {
val quote = quoteService.getQuote(quoteId, jwt)
} catch (e: Sep38NotFoundException) {
println("Quote not found, it may have expired")
// Request new quote
} catch (e: Sep38PermissionDeniedException) {
println("Invalid token, re-authenticating...")
// Re-authenticate via SEP-10
}

See also:

Inheritors

Constructors

Link copied to clipboard
constructor(message: String, cause: Throwable? = null)

Properties

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

Functions

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