Error handling
Every failure from Connect(), Status() and Disconnect() is a WiDasException with a stable
Code. The codes are the same strings the iOS and Android SDKs use. Catch the nested type to branch,
and log or translate by Code, so the same messages work on all three platforms.
public abstract class WiDasException : Exception
{
public string Code { get; }
public sealed class IssuanceRejected : WiDasException { } // "issuanceRejected"
public sealed class ServiceUnavailable : WiDasException { } // "serviceUnavailable"
public sealed class EntitlementMissing : WiDasException { } // "entitlementMissing"
public sealed class PasspointInstallFailed : WiDasException // "passpointInstallFailed"
{
public Reconciliation? Reconciliation { get; } // set when Disconnect() left something behind
}
public sealed class Revoked : WiDasException { } // "revoked"
public sealed class Network : WiDasException { } // "network"
public sealed class Cancelled : WiDasException { } // "cancelled"
public sealed class Internal : WiDasException { } // "internal"
}
The codes
| Code | Meaning | What to do |
|---|---|---|
issuanceRejected | Wi-DAS refused the request on its merits: an invalid signing request, validity or user identifier, or a refusal the SDK didn't recognise. | Fix the integration. Retrying as-is won't help. |
serviceUnavailable | A temporary fault on the Wi-DAS side, a timeout, or a rate limit. | Retry with backoff, a bounded number of times. |
entitlementMissing | Not allowed to onboard: your Broker or clientId isn't registered or is disabled, the token was refused, or Windows is older than 1607. | Check your registration and Broker setup. Not worth retrying. |
passpointInstallFailed | The profile or certificate couldn't be installed, or Disconnect() couldn't remove them. It's also raised, before any certificate or profile is installed, when the response's serverCaPem or one of your additionalServerTrustRoots is malformed, or isn't trusted by this machine for server authentication; InnerException says why. On a disconnect, Reconciliation says which step failed. | Log the detail. Retrying may help if the cause was temporary. |
revoked | The certificate is revoked. Raised only if your Broker passes on a certificateRevoked refusal (see below), which Wi-DAS doesn't send today. In practice you'll see revocation as ConnectionState.Revoked from Status(). | Call Disconnect(), then tell the user. |
network | Your Broker couldn't be reached, or the call timed out. | Retry once connectivity is back. |
cancelled | Reserved. The SDK doesn't raise it today. | — |
internal | An unexpected failure. InnerException holds the cause. Common ones: a user with characters outside ASCII letters, digits, -, . and _; an exception your IBroker let escape; or a Broker response with missing fields. | Check InnerException first. Report it to us if the cause isn't on your side. |
There's no attestationUnavailable or attestationRejected on Windows, since nothing is attested.
Where the codes come from
Your IBroker implementation decides the first step. Throwing BrokerUnreachableException becomes
network. Throwing BrokerRefusedException with the problem title from your Broker's response is
mapped like this:
title | Code |
|---|---|
brokerNotAuthorised, partnerUnknown, partnerDisabled, Unauthorized, Forbidden | entitlementMissing |
caUnavailable, serverTrustUnavailable, passpointConfigUnavailable, idempotencyUnavailable, issuanceTimedOut, issuanceInProgress | serviceUnavailable |
Too Many Requests, Service Unavailable, Bad Gateway, Gateway Timeout, An error occurred while processing your request. | serviceUnavailable |
certificateRevoked (not sent by Wi-DAS today; mapped so it never lands in issuanceRejected if it is) | revoked |
| Anything else, or no title | issuanceRejected |
Pass the title through unchanged. Matching is exact, so a title your Broker trims, re-cases or rewords
falls through to issuanceRejected and looks like a genuine refusal.
Branching example
try
{
await Task.Run(() => flow.Connect(userId, "P365D"));
}
catch (Exception ex) when (ex is WiDasException.ServiceUnavailable or WiDasException.Network)
{
ScheduleRetry(); // transient: back off and try again
}
catch (WiDasException.EntitlementMissing)
{
ReportConfigurationProblem(); // registration, Broker or Windows version
}
catch (WiDasException.PasspointInstallFailed ex)
{
ShowInstallProblem(ex.Message);
}
catch (WiDasException ex)
{
ShowGenericError(ex.Code);
}
serviceUnavailable and network are worth retrying, but not forever. A fault caused by something in
the request comes back on every attempt, so give up after a few tries and report it.