build-error

Wrap error messages into a standard javascript error object

npm install build-error
10 downloads in the last month

Build Error

Wrap error messages into a javascript error object

Installation

npm install -S build-error

Usage

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)
npm loves you