KYCException

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

Base exception class for SEP-12 KYC API errors.

All SEP-12-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 KYC errors at different levels:

  • Catch KYCException for general KYC error handling

  • Catch specific subclasses for precise error recovery

Common error scenarios:

Example - General error handling:

try {
val response = kycService.getCustomerInfo(request)
} catch (e: CustomerNotFoundException) {
// Customer doesn't exist, need to register
println("Customer not found: ${e.accountId}")
} catch (e: UnauthorizedException) {
// JWT token invalid or expired
println("Authentication failed, please log in again")
} catch (e: KYCException) {
// Other KYC errors
println("KYC error: ${e.message}")
}

Example - Specific error recovery:

try {
kycService.postCustomerFile(largeFile, jwt)
} catch (e: FileTooLargeException) {
println("File too large: ${e.fileSize} bytes")
println("Please compress or resize the file")
} catch (e: InvalidFieldException) {
println("Invalid field: ${e.fieldName} - ${e.fieldError}")
}

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?