# BkperError

Standard error class for Bkper API errors.
Extends Error to enable instanceof checks and standard error handling.

## Extends

- `Error`

### Constructor

```ts
new BkperError(
   code, 
   message, 
   reason?): BkperError;
```

#### Parameters

| Parameter | Type |
| :------ | :------ |
| `code` | `number` |
| `message` | `string` |
| `reason?` | `string` |

#### Returns

`BkperError`

#### Overrides

```ts
Error.constructor
```

### code

```ts
readonly code: number;
```

HTTP status code (e.g., 404, 400, 500)

***

### message

```ts
message: string;
```

#### Inherited from

```ts
Error.message
```

***

### name

```ts
name: string;
```

#### Inherited from

```ts
Error.name
```

***

### reason?

```ts
readonly optional reason: string;
```

Machine-readable reason (e.g., "notFound", "badRequest")

***

### stack?

```ts
optional stack: string;
```

#### Inherited from

```ts
Error.stack
```

***

### prepareStackTrace()?

```ts
static optional prepareStackTrace: (err, stackTraces) => any;
```

Optional override for formatting stack traces

#### Parameters

| Parameter | Type |
| :------ | :------ |
| `err` | `Error` |
| `stackTraces` | `CallSite`[] |

#### Returns

`any`

#### See

https://v8.dev/docs/stack-trace-api#customizing-stack-traces

#### Inherited from

```ts
Error.prepareStackTrace
```

***

### stackTraceLimit

```ts
static stackTraceLimit: number;
```

#### Inherited from

```ts
Error.stackTraceLimit
```

### captureStackTrace()

```ts
static captureStackTrace(targetObject, constructorOpt?): void;
```

Create .stack property on a target object

#### Parameters

| Parameter | Type |
| :------ | :------ |
| `targetObject` | `object` |
| `constructorOpt?` | `Function` |

#### Returns

`void`

#### Inherited from

```ts
Error.captureStackTrace
```
