Wrap error messages into a standard javascript error object
JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore
README.md
index.js
package.json

README.md

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)