Error handling
connect() and disconnect() throw a typed WiDASError with stable cases, so you can branch in
code and say something useful to the user. status() never throws.
public enum WiDASError: Error, Equatable {
case attestationUnavailable
case attestationRejected
case issuanceRejected
case serviceUnavailable
case entitlementMissing
case passpointInstallFailed
case revoked
case network
case cancelled
}
The cases
| Case | Meaning | What to do |
|---|---|---|
attestationUnavailable | App Attest can't run here (Simulator, unsupported, or de-attested). | Degrade the UI. Don't loop on it. Test on a device. |
attestationRejected | Wi-DAS rejected the attestation. | Check the app is registered (Team ID + bundle ID) against your clientId. Not worth retrying as-is. |
issuanceRejected | Issuance was refused (bad CSR/validity/challenge, or an unknown/disabled partner). | Fix the integration; check requestedValidity and your registration. |
serviceUnavailable | A temporary server-side fault. The request wasn't refused on its merits. | Retry with backoff. |
entitlementMissing | A required capability or entitlement is missing. | Confirm App Attest and Hotspot Configuration are both on. |
passpointInstallFailed | The Passpoint profile wouldn't install. | Check the Hotspot Configuration entitlement and your Keychain access group. |
revoked | The certificate is revoked. | Call disconnect() to clean up, then tell the user. |
network | A transport or connectivity failure. | Retry once connectivity is back. |
cancelled | The operation was cancelled. | Nothing, or retry when the user asks. |
Where the cases come from
The API reports failures in a structured form, and the SDK maps each one to the matching
WiDASError. You only ever see the typed enum.
Branching example
do {
try await widas.connect(user: userID, requestedValidity: "P365D")
} catch WiDASError.serviceUnavailable, WiDASError.network {
scheduleRetry() // transient — back off and try again
} catch WiDASError.attestationRejected, WiDASError.entitlementMissing {
reportConfigurationProblem() // registration / entitlement — not user-fixable
} catch WiDASError.revoked {
try? await widas.disconnect() // clear the dead profile
showRevokedMessage()
} catch WiDASError.attestationUnavailable {
showUnsupportedDevice()
} catch {
showGenericError()
}
Retry the transient cases only
serviceUnavailable and network are worth a retry. attestationRejected, entitlementMissing,
and issuanceRejected point at a configuration or registration problem, so retrying without a fix
just fails again. Troubleshooting walks through the fixes.