npm.io
1.1.0 • Published 6 years ago

thing-assert

Licence
MIT
Version
1.1.0
Deps
0
Size
9 kB
Vulns
0
Weekly
0

thing-assert

GitHub license npm version Build Status codecov PRs Welcome Known Vulnerabilities npm download

Description

Nodejs's assert error has no status code. Through thing-assert you can define your own error status and capture from the thrown out error object.

Install

$ npm i thing-assert

Usage

const thingAssert = require('thing-assert')

try {
  thingAssert(false, 'error message', 400)
} catch (error) {
  console.log(error.status) // output 400
}

Questions & Suggestions

Please open an issue here.

License

MIT

Keywords