1.0.1 • Published 8 years ago

http-error-stream v1.0.1

Weekly downloads
1
License
MIT
Repository
github
Last release
8 years ago

http-error-stream stability

npm version build status test coverage downloads js-standard-style

Stream an error over http. Takes a server-error error and streams it back out.

Usage

const errorStream = require('http-error-stream')
const serverError = require('server-error')
const bole = require('bole')
const http = require('http')

const log = bole('my-service')
const error = serverError(log)

http.createServer(function (req, res) {
  const err = error.client('oh no!')
  // set statusCode, content-type and stream error as JSON
  errorStream(req, res, err).pipe(res)
}).listen

Installation

$ npm install http-error-stream

License

MIT