> For the complete documentation index, see [llms.txt](https://docs.caf.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.caf.io/caf-sdk/web-javascript/getting-started/smartauth/sdk-errors.md).

# SDK errors

### **Format**

All errors triggered by the SDK have the following properties:

| **Field**     | **Type** | **Description**    |
| ------------- | -------- | ------------------ |
| **`id`**      | `string` | Error identifier   |
| **`message`** | `string` | Additional Message |

**Tip:** You can use the call **isSdkError(error)** to check if an error is in this format:

```javascript
const identity = new Sdk(identityToken, options);

try {
    const response = await identityentity.verifyPolicy(cpfInput.value, policyInput.value);
}
catch (error) {
    if(identity.isSdkError(error)) {
        // The error is in the format above
    }
}
```

### **Types of errors**

### **`UnsupportedError`**

**ID:** `UNSUPPORTED`

**Description:** Triggered when the user's browser does not support some feature necessary for the SDK to work

### **`PermissionDeniedError`**

**ID:** `PERMISSION_DENIED`

**Description:** Triggered when the SDK has not been given permission to perform an action (such as opening the camera)

### **`AlreadyRunningError`**

**ID:** `ALREADY_RUNNING`

**Description:** Triggered when the **throwOnRecall** flag is set in the SDK options and a verification call is made while another one is already in progress.

### **`UserCanceledError`**

**ID:** `USER_CANCELED`

**Description:** Triggered when the user cancels an SDK operation

### **`NetworkError`**

**ID:** `NETWORK_ERROR`

**Description:** Triggered when a request to our servers fails

### **`InvalidResponseError`**

**ID:** `INVALID_RESPONSE`

**Description:** Triggered when a request to our servers did not get the expected result

### **`InternalServerError`**

**ID:** `INTERNAL_SERVER_ERROR`

**Description:** Triggered when there was an internal error in our servers

### **`TimeoutError`**

**ID:** `TIMEOUT`

**Description:** Triggered when some request from the SDK (not necessarily from the network) has exceeded the time limit

### **`PositionUnavailableError`**

**ID:** `POSITION_UNAVAILABLE`

**Description:** Triggered if there is an error while capturing the user's geolocation, other than a timeout or user permission specifically for the website.

{% hint style="info" %}
This usually occurs when the browser does not have permission from the operating system to use location services. Example: if the user is accessing the website through an Instagram webview, and does not allow the Instagram app to use location services in the iOS or Android settings.
{% endhint %}

### **`UnknownError`**

**ID:** `UNKNOWN`

**Description:** Triggered when an unknown error occurred

### **`ContextPending`**

**ID:** `CONTEXT_PENDING`

**Description:** Triggered when the context is pending manual analysis.

### **`FaceAuthentication`**

**ID:** `FACE_AUTHENTICATION`

**Description:** Triggered when an error occurs in the face authentication flow.

{% hint style="info" %}
The SDK does not return explicit exceptions about refusal reasons for authentication. Refusal reasons can be obtained from the [API](https://github.com/combateafraude/public-docs/blob/docs-sdks/web-javascript/getting-started/smartauth/broken-reference/README.md) response that looks for a specific authentication attempt.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.caf.io/caf-sdk/web-javascript/getting-started/smartauth/sdk-errors.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
