Errors
All errors produced by the TrustFactor SDK are wrapped in TrustFactorError. Match on the domain property to identify the error category and specific code.
TrustFactorError
The top-level SDK error type.
- iOS (Swift)
- Android (Java)
public struct TrustFactorError: Error {
public enum Domain: Hashable {
case client(code: ClientDomainCode)
case authentication(code: AuthenticationDomainCode)
case network(code: NetworkDomainCode)
case operationDecision(code: OperationDecisionDomainCode)
case profileAction(code: ProfileActionDomainCode)
case unknown
}
public let domain: Domain
public let parameters: [String: Any]
public init(domain: Domain, parameters: [String: Any] = [:])
}
// Named Error on Android
public class Error extends Exception {
public Error(Domain domain, Enum<?> domainCode, HashMap<String, String> parameters)
public Domain getDomain()
public Enum<?> getDomainCode()
public HashMap<String, String> getParameters()
}
ClientDomainCode
General SDK-state errors.
- iOS (Swift)
- Android (Java)
public enum TrustFactorError.ClientDomainCode: Hashable {
case notStarted
case deviceNotRegistered
case alreadyRegistered
case notAuthenticated
case needsUpdate
case serviceNotAvailable
case notAuthorized
case permanentlyLocked
case needsAuthentication
case deviceNotReady
case couldNotSyncProfiles
case apnsTokenNotSet
case applicationNotFound
case profileNotFound
case needsToAcceptTermsAndConditions
case integrationAppNotSuported
case invalidLanguage
case doesNotMatchRequirements
}
public enum ClientDomainCode {
NOT_STARTED,
DEVICE_NOT_REGISTERED,
ALREADY_REGISTERED,
NOT_AUTHENTICATED,
NEEDS_UPDATE,
SERVICE_NOT_AVAILABLE,
NOT_AUTHORIZED,
PERMANENTLY_LOCKED,
NEEDS_AUTHENTICATION,
DEVICE_NOT_READY,
COULD_NOT_SYNC_PROFILES,
APPLICATION_NOT_FOUND,
PROFILE_NOT_FOUND,
NEEDS_TO_ACCEPT_TERMS_AND_CONDITIONS,
INTEGRATION_APP_NOT_SUPPORTED,
INVALID_LANGUAGE,
DOES_NOT_MATCH_REQUIREMENTS
}
AuthenticationDomainCode
Errors related to PIN or biometric authentication.
- iOS (Swift)
- Android (Java)
public enum TrustFactorError.AuthenticationDomainCode: Hashable {
case wrongCredential
case cooldown(until: Date)
case biometricTokenExpired
case setup_newPinMatchesOld
case PINDoesNotMatchRequirements
case biometricAuthenticationNotEnabled
}
public enum AuthenticationDomainCode {
WRONG_CREDENTIAL,
COOLDOWN,
BIOMETRIC_TOKEN_EXPIRED,
NEW_PIN_CANNOT_MATCH_THE_OLD,
PIN_DOES_NOT_MATCH_REQUIREMENTS,
BIOMETRIC_AUTHENTICATION_NOT_ENABLED,
BIOMETRIC_AUTHENTICATION_FAILED,
BIOMETRIC_AUTHENTICATION_ERROR,
BIOMETRIC_AUTHENTICATION_CANCEL,
BIOMETRIC_AUTHENTICATION_LOCKED,
BIOMETRIC_AUTHENTICATION_KEY_PERMANENT_INVALIDATED,
BIOMETRIC_AUTHENTICATION_NOT_SUPPORTED
}
NetworkDomainCode
Errors related to network connectivity.
- iOS (Swift)
- Android (Java)
public enum TrustFactorError.NetworkDomainCode: Hashable {
case couldNotReachServices
}
public enum NetworkDomainCode {
COULD_NOT_REACH_SERVICES
}
OperationDecisionDomainCode
Errors that occur when approving or rejecting an operation.
- iOS (Swift)
- Android (Java)
public enum TrustFactorError.OperationDecisionDomainCode: Hashable {
case requireBiometricAuthentication
case requirePINAuthentication
case alreadyDecided
case cantDecideWithoutGettingDetails
}
public enum OperationDecisionDomainCode {
REQUIRE_BIOMETRIC_AUTHENTICATION,
REQUIRE_PIN_AUTHENTICATION,
ALREADY_DECIDED,
CANT_DECIDE_WITHOUT_GETTING_DETAILS,
EXPIRED
}
ProfileActionDomainCode
Errors related to profile association, dissociation, sharing, or recovery.
- iOS (Swift)
- Android (Java)
public enum TrustFactorError.ProfileActionDomainCode: Hashable {
case profileNotReady
case forgedProfile
case profileNotAssociatedToThisDevice
case couldNotCommunicateWithApplication(appName: String?)
case profileNeedsRevalidation
// Recovery
case invalidRecoveryCode
case recoveryCodeAlreadyUsed
// Association
case invalidAssociationCode
case alreadyAssociated
case associationCodeAlreadyUsed
case associationCodeExpired
case profileExceededMaxDevices
// Share
case expiredShareToken
}
public enum ProfileActionDomainCode {
PROFILE_NOT_READY,
FORGED_PROFILE,
PROFILE_NOT_ASSOCIATED_TO_THIS_DEVICE,
COULD_NOT_COMMUNICATE_WITH_APPLICATION,
PROFILE_NEEDS_REVALIDATION,
INVALID_RECOVERY_CODE,
RECOVERY_CODE_ALREADY_USED,
INVALID_ASSOCIATION_CODE,
ALREADY_ASSOCIATED,
ASSOCIATION_CODE_ALREADY_USED,
ASSOCIATION_CODE_EXPIRED,
PROFILE_EXCEEDED_MAX_DEVICES,
EXPIRED_SHARE_TOKEN,
PROFILES_NOT_DISSOCIATED,
PROFILE_NOT_DISSOCIATED
}