0.2.0 • Published 10 years ago

decanat-miscue v0.2.0

Weekly downloads
4
License
MIT
Repository
github
Last release
10 years ago

Miscue Build Status

Miscue class for Decanat, to provide better interface to HTTP errors and status in general.

var Miscue = require('miscue');
// instantiate
var status = new Miscue(422, { email: 'improper' });
// play
status instanceof Error; // returns true
alert(status); // alerts 'client error (422): {"email":"improper"}'

Installation

Install with component:

$ component install decanat/miscue

API

Set custom name

var status = new Miscue(422, { email: 'improper' });
// status.name === 'client error'

status.set('validation error');
// status.name === 'validation error'

status.set(422);
// status.name === 'client error'

Mark as Error

var status = new Miscue(600, 'coffee break');
// status instanceof Error === false

status.turnError();
// status instanceof Error === true

Testing

To test with PhantomJS, run:

$ make test    

License

The MIT License (MIT)

0.2.0

10 years ago

0.1.3

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago