[**Documentation**](../../../../README)

***

[Documentation](../../../../README) / [@zerotal/core](../../README) / [index](../README) / abort

# Function: abort()

## Call Signature

> **abort**(`message`): `never`

Defined in: [helpers/response.ts:397](https://github.com/zerotaldev/zerotal/blob/1d6fb26b05b18ba077de1bfaeb46c42131cd8b70/packages/core/src/helpers/response.ts#L397)

Throw an HTTP error to end the request. Accepts a message (defaults to 500),
an explicit status plus message, or a `ZerotalError` subclass to instantiate.

### Parameters

#### message

`string`

### Returns

`never`

### Throws

(or the given `ZerotalError` subclass) — always; the return
type is `never`.

### Example

```ts
abort('Something went wrong');           // 500
abort(403, 'Forbidden');                 // explicit status
abort(NotFoundError);                    // throw a specific error class
```

## Call Signature

> **abort**(`status`, `message`): `never`

Defined in: [helpers/response.ts:398](https://github.com/zerotaldev/zerotal/blob/1d6fb26b05b18ba077de1bfaeb46c42131cd8b70/packages/core/src/helpers/response.ts#L398)

Throw an HTTP error to end the request. Accepts a message (defaults to 500),
an explicit status plus message, or a `ZerotalError` subclass to instantiate.

### Parameters

#### status

`number`

#### message

`string`

### Returns

`never`

### Throws

(or the given `ZerotalError` subclass) — always; the return
type is `never`.

### Example

```ts
abort('Something went wrong');           // 500
abort(403, 'Forbidden');                 // explicit status
abort(NotFoundError);                    // throw a specific error class
```

## Call Signature

> **abort**(`ErrorClass`): `never`

Defined in: [helpers/response.ts:399](https://github.com/zerotaldev/zerotal/blob/1d6fb26b05b18ba077de1bfaeb46c42131cd8b70/packages/core/src/helpers/response.ts#L399)

Throw an HTTP error to end the request. Accepts a message (defaults to 500),
an explicit status plus message, or a `ZerotalError` subclass to instantiate.

### Parameters

#### ErrorClass

() => [`ZerotalError`](../classes/ZerotalError)

### Returns

`never`

### Throws

(or the given `ZerotalError` subclass) — always; the return
type is `never`.

### Example

```ts
abort('Something went wrong');           // 500
abort(403, 'Forbidden');                 // explicit status
abort(NotFoundError);                    // throw a specific error class
```
