Skip to content

junosuarez/resource-error

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

resource-error

error classes relating to resources, aligned with http codes

The intention is to have generic error classes which describe some sort of resource or data entity, and to align with (but not fully replicate) http error semantics.

usage

var resourceError = require('resource-error')

var userId = 0
throw new resourceError.NotFound('User ' + userId)

Supports the features of [typedError](https://npm.im/typederror)

Error types

  • resourceError.NotFound code: 404

  • resourceError.NotAuthorized code: 403

  • resourceError.Invalid code: 400

  • resourceError.Err code: 500

installation

$ npm install resource-errors

running the tests

Current there are no tests. The underlying module, [typedError](https://npm.im/typederror), has tests.

contributors

license

MIT. (c) MMXIII jden jason@denizac.org. See LICENSE.md

About

error classes relating to resources, aligned with http codes

Resources

License

Stars

Watchers

Forks

Packages

No packages published