Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/nisaacson/build-error

Wrap error messages into a standard javascript error object
https://github.com/nisaacson/build-error

Last synced: about 1 month ago
JSON representation

Wrap error messages into a standard javascript error object

Awesome Lists containing this project

README

        

# Build Error

Wrap error messages into a javascript error object

# Installation

```bash
npm install -S build-error
```

# Usage

```javascript
var buildError = require('build-error')
var errorMessage = 'Something blew up'
var source = 'invalid data supplied'
// meta is an optional object that will be added to the error object
var meta = {
foo: 'bar'
}
var error = buildError(errorMessage, source, meta)
console.dir(error)
```