---
title: Handle WebAuthn errors
description: When an error occurs during the registration or authentication process, the Ping (ForgeRock) SDK for Android returns the WebAuthnResponseException exception. In most cases, errors are returned as per the specification. The error code can be found from WebAuthnResponseExcetpion.getErrorCode().
component: sdks
version: latest
page_id: sdks:sdks:use-cases/mobile-biometrics/android/06-error-handling
canonical_url: https://docs.pingidentity.com/sdks/latest/sdks/use-cases/mobile-biometrics/android/06-error-handling.html
llms_txt: https://docs.pingidentity.com/sdks/llms.txt
docs_for_agents: https://developer.pingidentity.com/build-with-ai/docs-for-agents.md
revdate: Wed, 17 May 2023 14:10:20 +0100
keywords: ["PingOne Advanced Identity Cloud", "PingAM", "Journeys", "Setup &amp; Configuration", "Source Code", "Use Case", "SDK"]
section_ids:
  convert_exceptions_for_handling_by_the_pingam_server: Convert exceptions for handling by the PingAM server
---

# Handle WebAuthn errors

When an error occurs during the registration or authentication process, the Ping (ForgeRock) SDK for Android returns the `WebAuthnResponseException` exception. In most cases, errors are returned as per the [specification](https://heycam.github.io/webidl/#idl-DOMException-error-names). The error code can be found from `WebAuthnResponseExcetpion.getErrorCode()`.

## Convert exceptions for handling by the PingAM server

When you use `WebAuthnRegistrationCallback.register()` or `WebAuthnAuthenticationCallback.authenticate()`, the SDK automatically parses the error into the appropriate format for PingAM. When PingAM receives the completed callback from the SDK the authentication flow follows the WebAuthn registration process to reach the appropriate outcome.

However, if the error has to be handled manually, the `WebAuthnResponseException` class provides a convenience method called `toServerError()` to convert the error into the appropriate format.

```java
callback.register(this, node, new FRListener<Void>() {
    @Override
    public void onSuccess(Void result) {
        next();
    }

    @Override
    public void onException(Exception e) {
        if (e instanceof WebAuthnResponseException) {
            WebAuthnResponseException exception = (WebAuthnResponseException) e;
            exception.getErrorCode(); // Do something with the error or proceed to the next node.
        }
    }
});
```

|   |                                                                                                                                                                                                                                                                                                                                       |
| - | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|   | `WebAuthnResponseExcetpion.getErrorCode() == com.google.android.gms.fido.fido2.api.common.ErrorCode#NOT_SUPPORTED_ERR` results in an `Unsupported` outcome in both WebAuthn Registration node and WebAuthn Authentication node.Any other `WebAuthnResponseExcetpion.getErrorCode()` results in a `Client Error` outcome in the nodes. |
