Skip to main content

Error handling

connect() and disconnect() throw a sealed WiDASException with stable types, so you can branch in code. status() never throws.

sealed class WiDASException : Exception() {
data object AttestationUnavailable : WiDASException()
data object AttestationRejected : WiDASException()
data object IssuanceRejected : WiDASException()
data object EntitlementMissing : WiDASException()
data object PasspointInstallFailed : WiDASException()
data object Revoked : WiDASException()
data object Network : WiDASException()
data object Cancelled : WiDASException()
}

The types

TypeMeaningWhat to do
AttestationUnavailablePlay Integrity can't run here (no Play Services, or an unsupported device).Degrade the UI. Don't loop on it.
AttestationRejectedWi-DAS rejected the attestation.Check the app-signing cert SHA-256 and package name are registered against your partnerId. See the Play App Signing trap. Not worth retrying as-is.
IssuanceRejectedIssuance was refused (bad CSR/validity/challenge, or an unknown/disabled partner).Fix the integration; check requestedValidity and your registration.
EntitlementMissingYour partner is unknown or disabled, so there's no valid entitlement.Confirm your partnerId is registered and enabled.
PasspointInstallFailedThe Passpoint profile wouldn't install.Check Wi-Fi permissions and that the device supports Passpoint suggestions.
RevokedThe certificate is revoked.Call disconnect() to clean up, then tell the user.
NetworkA transport or connectivity failure.Retry once connectivity is back.
CancelledThe operation was cancelled.Nothing, or retry when the user asks.
One difference from iOS

Android has no separate serviceUnavailable type. A server-side fault that isn't a refusal on the merits surfaces as IssuanceRejected or Network. iOS breaks that out into its own serviceUnavailable case.

Where the types come from

The API reports failures in a structured form, and the SDK maps each one to a typed exception. You only ever see the sealed WiDASException.

Branching example

try {
widas.connect(user = userId, requestedValidity = "P365D")
} catch (e: WiDASException) {
when (e) {
WiDASException.Network -> scheduleRetry() // transient
WiDASException.AttestationRejected,
WiDASException.EntitlementMissing -> reportConfigProblem() // registration issue
WiDASException.Revoked -> {
widas.disconnect() // clear the dead profile
showRevokedMessage()
}
WiDASException.AttestationUnavailable -> showUnsupportedDevice()
else -> showGenericError()
}
}
Retry the transient cases only

Network is worth a retry with backoff. AttestationRejected, EntitlementMissing, and IssuanceRejected point at a configuration or registration problem, so retrying without a fix just fails again. Troubleshooting walks through the fixes.