# Class: NablaConnectError

The error of every rejected SDK promise and of the `error` event. Branch on `code`.

## Extends[​](#extends "Direct link to Extends")

* `Error`

## Constructors[​](#constructors "Direct link to Constructors")

### Constructor[​](#constructor "Direct link to Constructor")

> **new NablaConnectError**(`code`, `reason?`, `options?`): `NablaConnectError`

Builds an error, for example to fake a rejection in your tests.

#### Parameters[​](#parameters "Direct link to Parameters")

##### code[​](#code "Direct link to code")

[`NablaConnectErrorCode`](/connect/sdk/reference/type-aliases/NablaConnectErrorCode.md)

The stable code.

##### reason?[​](#reason "Direct link to reason?")

`string`

With `COMMAND_REJECTED`, why the iframe refused. With a command `TIMEOUT`, `NO_RESULT`.

##### options?[​](#options "Direct link to options?")

`ErrorOptions`

The `cause`, when the error wraps another one.

#### Returns[​](#returns "Direct link to Returns")

`NablaConnectError`

#### Overrides[​](#overrides "Direct link to Overrides")

`Error.constructor`

## Properties[​](#properties "Direct link to Properties")

### cause?[​](#cause "Direct link to cause?")

> `optional` **cause?**: `unknown`

#### Inherited from[​](#inherited-from "Direct link to Inherited from")

`Error.cause`

***

### code[​](#code-1 "Direct link to code")

> `readonly` **code**: [`NablaConnectErrorCode`](/connect/sdk/reference/type-aliases/NablaConnectErrorCode.md)

A stable code.

***

### message[​](#message "Direct link to message")

> **message**: `string`

#### Inherited from[​](#inherited-from-1 "Direct link to Inherited from")

`Error.message`

***

### name[​](#name "Direct link to name")

> **name**: `string`

#### Inherited from[​](#inherited-from-2 "Direct link to Inherited from")

`Error.name`

***

### reason?[​](#reason-1 "Direct link to reason?")

> `readonly` `optional` **reason?**: `string`

With `COMMAND_REJECTED`, why the iframe refused or failed the command: `NOT_ALLOWED`, `STALE_STATE`, `INVALID_SESSION`, `EXPORT_FAILED` or `UNKNOWN`. With the `TIMEOUT` of a command, `NO_RESULT`: the iframe may still run it.

***

### stack?[​](#stack "Direct link to stack?")

> `optional` **stack?**: `string`

#### Inherited from[​](#inherited-from-3 "Direct link to Inherited from")

`Error.stack`
