Error management
This page introduces error management and bug reporting in Mobile FIDO SDK. This section covers the following use cases:
-
Report the brief set of actionable result codes to the client application.
-
Supply more technical details about the problems for debugging and technical support.
Error check
Both the Android and iOS platforms surface operation failures so that your application can handle them and display an appropriate message to the end user.
-
Android: SDK operations report failures through a
Fido2Exceptionin the callback of the operation (for example,onError(Fido2Exception)). The error corresponds to aFido2ErrorCodevalue. -
iOS: SDK operations report failures through an
NSErrorin theTGFErrorDomaindomain, delivered in the completion handler of the operation (for example,respond(with:completion:)). The errorcodecorresponds to aTGFErrorvalue.
When a runtime self-protection (RASP) check fails, for example, on a rooted or jailbroken device, the executing SDK operation is aborted and reported as a normal, catchable error, not an application crash: on Android a Fido2Exception carrying ERROR_UNSAFE_ENVIRONMENT_DETECTED (0x0d), and on iOS an NSError with TGFErrorUnsafeEnvironmentDetected (0x0d). For the full list of threats these checks cover and the platforms and build types on which they run, see Security countermeasures.
Programming errors
Both platforms may additionally raise language-level runtime errors for programmer mistakes (for example, passing a null/nil argument that breaks a method contract, or supplying an invalid configuration). These indicate integration bugs to fix during development rather than conditions to recover from at runtime.
Note
It is not recommended to catch these runtime errors (RuntimeException on Android, NSException on iOS). Fix the underlying integration error instead.