# Type Alias: ScannerError

[Mobile Document Scanner API Reference](../index.md) / ScannerError

# Type Alias: ScannerError

> **ScannerError** = \{ `kind`: `"license"`; `message`: `string`; `reason`: [`LicenseErrorReason`](LicenseErrorReason.md); \} \| \{ `kind`: `"cameraPermission"`; `message`: `string`; \} \| \{ `kind`: `"cameraUnavailable"`; `message`: `string`; \} \| \{ `kind`: `"container"`; `message`: `string`; `selector?`: `string`; \} \| \{ `engine`: `"captureVision"` \| `"documentViewer"`; `kind`: `"engineLoad"`; `message`: `string`; \} \| \{ `kind`: `"internal"`; `message`: `string`; \}

Defined in: [src/faults.ts:6](https://github.com/Dynamsoft/document-scanner-javascript/blob/main/src/faults.ts#L6)

The reason that a session failed. To handle the error, read `kind`, because the
wording of `message` can change. A minor release may add a kind, so
a switch on `kind` needs a default branch.

## Union Members

### Type Literal

\{ `kind`: `"license"`; `message`: `string`; `reason`: [`LicenseErrorReason`](LicenseErrorReason.md); \}

The license check failed. [reason](LicenseErrorReason.md) says why.

***

### Type Literal

\{ `kind`: `"cameraPermission"`; `message`: `string`; \}

The user or the browser refused access to the camera.

***

### Type Literal

\{ `kind`: `"cameraUnavailable"`; `message`: `string`; \}

The document scanner could not open a camera.

***

### Type Literal

\{ `kind`: `"container"`; `message`: `string`; `selector?`: `string`; \}

A container selector matched no element. `selector` names it.

***

### Type Literal

\{ `engine`: `"captureVision"` \| `"documentViewer"`; `kind`: `"engineLoad"`; `message`: `string`; \}

An engine, or one of its runtime files, failed to load. `engine` names the engine.

***

### Type Literal

\{ `kind`: `"internal"`; `message`: `string`; \}

Any other failure.
