npm.io
0.0.1 • Published 8 years ago

joi-http-errors

Licence
—
Version
0.0.1
Deps
1
Vulns
0
Weekly
0

joi-http-errors

Joi error handler with http errors

Usage

const Joi = require('joi')

const errorHandler = require('@local/joi-http-errors')

const schema = Joi.object({ email: Joi.string().email() })

schema
  .validate({ email: '@exo' })
  .catch(err => {
    // err.status = 422
    // err.source = { path, type, ... }
  })