> For the complete documentation index, see [llms.txt](https://docs.facephi.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.facephi.com/docs.facephi-en/sdks/sdk-web/componentes/selphid-documentos/eventos/exceptioncaptured.md).

# exceptionCaptured

## Details

It is emitted for errors or unexpected situations during capture.

**Event:** `exceptionCaptured`

**Type:** `FacephiSelphidWidgetCustomEvent<ExceptionCapturedEvent>` | `CustomEvent<ExceptionCapturedEvent>`

### Syntax

```typescript
selphid.addEventListener('exceptionCaptured', onExceptionCaptured);
```

### Received object

The payload is of type `SelphidExceptionCapturedDetail` and is in `event.detail.detail`:

* `eventType` (`string`): Type of emitted event.
* `exceptionType` (`string`): Exception type (`ExceptionType`).
* `message` (`string`): Brief description of the error.
* `code` (`string`): Error code associated with `exceptionType`.

**Values `exceptionType` — terminals**:

| Value                         | Description                               |
| ----------------------------- | ----------------------------------------- |
| `AndroidWebViewBehaviour`     | The widget cannot run in Android WebView. |
| `BrowserApiNotCompatible`     | The browser is not compatible.            |
| `CameraHardwareError`         | Error accessing the camera.               |
| `PermissionsDenied`           | Required permissions not granted.         |
| `CameraPermissionDenied`      | Camera permission denied.                 |
| `MicrophonePermissionDenied`  | Microphone permission denied.             |
| `SettingsError`               | Misformatted configuration property.      |
| `UnknownInternalError`        | Unknown internal error.                   |
| `ExternalCameraChangeTimeout` | Timeout when switching external camera.   |

**Values `exceptionType` — extraction**:

| Value          | Description                               |
| -------------- | ----------------------------------------- |
| `ErrorTimeout` | The extraction timeout has been exceeded. |

**Values `code`**:

| `exceptionType`              | Code      |
| ---------------------------- | --------- |
| `AndroidWebViewBehaviour`    | `SPD_318` |
| `UnknownInternalError`       | `SPD_329` |
| `CameraHardwareError`        | `SPD_305` |
| `PermissionsDenied`          | `SPD_332` |
| `CameraPermissionDenied`     | `SPD_301` |
| `MicrophonePermissionDenied` | `SPD_319` |
| `SettingsError`              | `SPD_320` |
| `BrowserApiNotCompatible`    | `SPD_321` |
| `ErrorTimeout`               | `SPD_001` |

## Description

Allows filtering and reacting to the different types of error during document capture.

### Considerations

The payload is in `event.detail.detail` (see [event format](/docs.facephi-en/sdks/sdk-web/componentes/selphid-documentos/eventos.md#formato-de-los-eventos)). Terminal exceptions show an error view and close the widget after [errorTimer](/docs.facephi-en/sdks/sdk-web/componentes/selphid-documentos/propiedades/errortimer.md).

SPD codes are aligned with the table of [results](/docs.facephi-en/sdks/sdk-web/componentes/selphid-documentos/resultados.md#codigos-de-error). For `ExternalCameraChangeTimeout`, see the value emitted in `code`.

***

## Example

```jsx
<facephi-selphid-widget
    onExceptionCaptured={(event) => {
      const { exceptionType, message, code } = event.detail.detail;
      console.error(code, exceptionType, message);
    }}
/>
```

```typescript
import { type SelphidExceptionCapturedDetail } from '@facephi/sdk-web-wc';

selphid.addEventListener('exceptionCaptured', (event) => {
  const detail: SelphidExceptionCapturedDetail = event.detail.detail;
});
```
