An open API service indexing awesome lists of open source software.

https://github.com/richienb/pretty-throw

Throw formatted errors.
https://github.com/richienb/pretty-throw

Last synced: 19 days ago
JSON representation

Throw formatted errors.

Awesome Lists containing this project

README

          

# Pretty throw [![Travis CI Build Status](https://img.shields.io/travis/com/Richienb/pretty-throw/master.svg?style=for-the-badge)](https://travis-ci.com/Richienb/pretty-throw)

Throw formatted errors.

[![NPM Badge](https://nodei.co/npm/pretty-throw.png)](https://npmjs.com/package/pretty-throw)

## Install

```sh
npm install pretty-throw
```

## Usage

```js
const prettyThrow = require("pretty-throw");
prettyThrow(new Error("Test error."));
```

### Output

![Example output](media/example.png)

## API

### prettyThrow(error, options?)

#### error

Type: `Error`

The error to be thrown.

#### options

Type: `object`

##### exit

Type: `boolean`\
Default: `true`

Exit the process after displaying the error.