otto-errors
Advanced tools
Comparing version 0.0.2 to 0.1.0
'use strict'; | ||
// Modules | ||
var util = require('util'); | ||
// Error - ErrorBadRequest | ||
function ErrorBadRequest (message) { | ||
Error.call(this); | ||
// Add Information | ||
@@ -17,3 +22,6 @@ this.name = 'ErrorBadRequest'; | ||
// Parent is Error | ||
util.inherits(ErrorBadRequest, Error); | ||
// Export | ||
module.exports = ErrorBadRequest; | ||
module.exports = ErrorBadRequest; |
'use strict'; | ||
// Modules | ||
var util = require('util'); | ||
// Error - ErrorConflict | ||
function ErrorConflict (message) { | ||
Error.call(this); | ||
// Add Information | ||
@@ -17,3 +22,6 @@ this.name = 'ErrorConflict'; | ||
// Parent is Error | ||
util.inherits(ErrorConflict, Error); | ||
// Export | ||
module.exports = ErrorConflict; | ||
module.exports = ErrorConflict; |
@@ -8,2 +8,3 @@ | ||
ErrorConflict : require('./conflict.error.js'), | ||
ErrorLocked : require('./locked.error.js'), | ||
ErrorNotFound : require('./not_found.error.js'), | ||
@@ -10,0 +11,0 @@ ErrorRead : require('./read.error.js'), |
'use strict'; | ||
// Modules | ||
var util = require('util'); | ||
// Error - ErrorNotFound | ||
function ErrorNotFound (message, data) { | ||
Error.call(this); | ||
// Add Information | ||
@@ -24,3 +29,6 @@ this.name = 'ErrorNotFound'; | ||
// Parent is Error | ||
util.inherits(ErrorNotFound, Error); | ||
// Export | ||
module.exports = ErrorNotFound; | ||
module.exports = ErrorNotFound; |
'use strict'; | ||
// Modules | ||
var util = require('util'); | ||
// Error - ErrorRead | ||
function ErrorRead (message) { | ||
Error.call(this); | ||
// Add Information | ||
@@ -17,3 +22,6 @@ this.name = 'ErrorRead'; | ||
// Parent is Error | ||
util.inherits(ErrorRead, Error); | ||
// Export | ||
module.exports = ErrorRead; | ||
module.exports = ErrorRead; |
'use strict'; | ||
// Modules | ||
var util = require('util'); | ||
// Error - ErrorSave | ||
function ErrorSave (message) { | ||
Error.call(this); | ||
// Add Information | ||
@@ -17,3 +22,6 @@ this.name = 'ErrorSave'; | ||
// Parent is Error | ||
util.inherits(ErrorSave, Error); | ||
// Export | ||
module.exports = ErrorSave; | ||
module.exports = ErrorSave; |
'use strict'; | ||
// Modules | ||
var util = require('util'); | ||
// Error - ErrorUnauthorized | ||
function ErrorUnauthorized (message) { | ||
Error.call(this); | ||
// Add Information | ||
@@ -17,3 +22,6 @@ this.name = 'ErrorUnauthorized'; | ||
// Parent is Error | ||
util.inherits(ErrorUnauthorized, Error); | ||
// Export | ||
module.exports = ErrorUnauthorized; | ||
module.exports = ErrorUnauthorized; |
{ | ||
"name" : "otto-errors", | ||
"version" : "0.0.2", | ||
"version" : "0.1.0", | ||
"repository" : "https://github.com/ottojs/otto-errors.git", | ||
@@ -8,6 +8,6 @@ "main" : "./lib/index.js", | ||
"devDependencies" : { | ||
"jshint" : "2.5.2", | ||
"mocha" : "1.20.1", | ||
"should" : "4.0.4", | ||
"istanbul" : "0.3.0" | ||
"jshint" : "2.5.10", | ||
"mocha" : "2.0.1", | ||
"should" : "4.3.0", | ||
"istanbul" : "0.3.2" | ||
}, | ||
@@ -18,5 +18,4 @@ "scripts" : { | ||
"engines" : { | ||
"node" : "0.10.x", | ||
"npm" : "1.4.x" | ||
"node" : "0.10.x" | ||
} | ||
} |
@@ -7,24 +7,37 @@ | ||
function SomeObject () { | ||
this.type = 'object'; | ||
} | ||
// Subject | ||
var error_bad_request = require('../lib/bad_request.error.js'); | ||
var ErrorBadRequest = require('../lib/bad_request.error.js'); | ||
describe('Error - ErrorBadRequest', function () { | ||
it('should be instance of "ErrorBadRequest"', function () { | ||
new ErrorBadRequest().should.be.instanceof(ErrorBadRequest); | ||
}); | ||
it('should be instance of "Error" (parent)', function () { | ||
new ErrorBadRequest().should.be.instanceof(Error); | ||
new ErrorBadRequest().should.not.be.instanceof(SomeObject); | ||
}); | ||
it('should have a name of "ErrorBadRequest"', function () { | ||
new error_bad_request().should.have.property('name').and.equal('ErrorBadRequest'); | ||
new ErrorBadRequest().should.have.property('name').and.equal('ErrorBadRequest'); | ||
}); | ||
it('should have a type of "client"', function () { | ||
new error_bad_request().should.have.property('type').and.equal('client'); | ||
new ErrorBadRequest().should.have.property('type').and.equal('client'); | ||
}); | ||
it('should have a status of 400', function () { | ||
new error_bad_request().should.have.property('status').and.equal(400); | ||
new ErrorBadRequest().should.have.property('status').and.equal(400); | ||
}); | ||
it('should have a message only when one is provided', function () { | ||
new error_bad_request().should.not.have.property('message'); | ||
new error_bad_request('My Message').should.have.property('message').and.equal('My Message'); | ||
it('should update the message when one is provided', function () { | ||
new ErrorBadRequest().should.have.property('message').and.equal(''); | ||
new ErrorBadRequest('My Message').should.have.property('message').and.equal('My Message'); | ||
}); | ||
}); | ||
}); |
@@ -7,24 +7,37 @@ | ||
function SomeObject () { | ||
this.type = 'object'; | ||
} | ||
// Subject | ||
var error_conflict = require('../lib/conflict.error.js'); | ||
var ErrorConflict = require('../lib/conflict.error.js'); | ||
describe('Error - ErrorConflict', function () { | ||
it('should be instance of "ErrorConflict"', function () { | ||
new ErrorConflict().should.be.instanceof(ErrorConflict); | ||
}); | ||
it('should be instance of "Error" (parent)', function () { | ||
new ErrorConflict().should.be.instanceof(Error); | ||
new ErrorConflict().should.not.be.instanceof(SomeObject); | ||
}); | ||
it('should have a name of "ErrorConflict"', function () { | ||
new error_conflict().should.have.property('name').and.equal('ErrorConflict'); | ||
new ErrorConflict().should.have.property('name').and.equal('ErrorConflict'); | ||
}); | ||
it('should have a type of "client"', function () { | ||
new error_conflict().should.have.property('type').and.equal('client'); | ||
new ErrorConflict().should.have.property('type').and.equal('client'); | ||
}); | ||
it('should have a status of 409', function () { | ||
new error_conflict().should.have.property('status').and.equal(409); | ||
new ErrorConflict().should.have.property('status').and.equal(409); | ||
}); | ||
it('should have a message only when one is provided', function () { | ||
new error_conflict().should.not.have.property('message'); | ||
new error_conflict('My Message').should.have.property('message').and.equal('My Message'); | ||
it('should update the message when one is provided', function () { | ||
new ErrorConflict().should.have.property('message').and.equal(''); | ||
new ErrorConflict('My Message').should.have.property('message').and.equal('My Message'); | ||
}); | ||
}); | ||
}); |
@@ -7,30 +7,43 @@ | ||
function SomeObject () { | ||
this.type = 'object'; | ||
} | ||
// Subject | ||
var error_not_found = require('../lib/not_found.error.js'); | ||
var ErrorNotFound = require('../lib/not_found.error.js'); | ||
describe('Error - ErrorNotFound', function () { | ||
it('should be instance of "ErrorNotFound"', function () { | ||
new ErrorNotFound().should.be.instanceof(ErrorNotFound); | ||
}); | ||
it('should be instance of "Error" (parent)', function () { | ||
new ErrorNotFound().should.be.instanceof(Error); | ||
new ErrorNotFound().should.not.be.instanceof(SomeObject); | ||
}); | ||
it('should have a name of "ErrorNotFound"', function () { | ||
new error_not_found().should.have.property('name').and.equal('ErrorNotFound'); | ||
new ErrorNotFound().should.have.property('name').and.equal('ErrorNotFound'); | ||
}); | ||
it('should have a type of "client"', function () { | ||
new error_not_found().should.have.property('type').and.equal('client'); | ||
new ErrorNotFound().should.have.property('type').and.equal('client'); | ||
}); | ||
it('should have a status of 404', function () { | ||
new error_not_found().should.have.property('status').and.equal(404); | ||
new ErrorNotFound().should.have.property('status').and.equal(404); | ||
}); | ||
it('should have a message only when one is provided', function () { | ||
new error_not_found().should.not.have.property('message'); | ||
new error_not_found('My Message').should.have.property('message').and.equal('My Message'); | ||
it('should update the message when one is provided', function () { | ||
new ErrorNotFound().should.have.property('message').and.equal(''); | ||
new ErrorNotFound('My Message').should.have.property('message').and.equal('My Message'); | ||
}); | ||
it('should not have a data property by default', function () { | ||
new error_not_found().should.not.have.property('data'); | ||
new ErrorNotFound().should.not.have.property('data'); | ||
}); | ||
it('should have a data property when sent an object with method', function () { | ||
var error = new error_not_found('message', { method : 'crystal' }); | ||
var error = new ErrorNotFound('message', { method : 'crystal' }); | ||
error.should.have.property('data').and.be.type('object'); | ||
@@ -41,3 +54,3 @@ error.data.should.have.property('method').and.equal('crystal'); | ||
it('should have a data property when sent an object with path', function () { | ||
var error = new error_not_found('message', { path : 'dirt' }); | ||
var error = new ErrorNotFound('message', { path : 'dirt' }); | ||
error.should.have.property('data').and.be.type('object'); | ||
@@ -47,2 +60,2 @@ error.data.should.have.property('path').and.equal('dirt'); | ||
}); | ||
}); |
@@ -7,24 +7,37 @@ | ||
function SomeObject () { | ||
this.type = 'object'; | ||
} | ||
// Subject | ||
var error_read = require('../lib/read.error.js'); | ||
var ErrorRead = require('../lib/read.error.js'); | ||
describe('Error - ErrorRead', function () { | ||
it('should be instance of "ErrorRead"', function () { | ||
new ErrorRead().should.be.instanceof(ErrorRead); | ||
}); | ||
it('should be instance of "Error" (parent)', function () { | ||
new ErrorRead().should.be.instanceof(Error); | ||
new ErrorRead().should.not.be.instanceof(SomeObject); | ||
}); | ||
it('should have a name of "ErrorRead"', function () { | ||
new error_read().should.have.property('name').and.equal('ErrorRead'); | ||
new ErrorRead().should.have.property('name').and.equal('ErrorRead'); | ||
}); | ||
it('should have a type of "server"', function () { | ||
new error_read().should.have.property('type').and.equal('server'); | ||
new ErrorRead().should.have.property('type').and.equal('server'); | ||
}); | ||
it('should have a status of 500', function () { | ||
new error_read().should.have.property('status').and.equal(500); | ||
new ErrorRead().should.have.property('status').and.equal(500); | ||
}); | ||
it('should have a message only when one is provided', function () { | ||
new error_read().should.not.have.property('message'); | ||
new error_read('My Message').should.have.property('message').and.equal('My Message'); | ||
it('should update the message when one is provided', function () { | ||
new ErrorRead().should.have.property('message').and.equal(''); | ||
new ErrorRead('My Message').should.have.property('message').and.equal('My Message'); | ||
}); | ||
}); | ||
}); |
@@ -7,24 +7,37 @@ | ||
function SomeObject () { | ||
this.type = 'object'; | ||
} | ||
// Subject | ||
var error_save = require('../lib/save.error.js'); | ||
var ErrorSave = require('../lib/save.error.js'); | ||
describe('Error - ErrorSave', function () { | ||
it('should be instance of "ErrorSave"', function () { | ||
new ErrorSave().should.be.instanceof(ErrorSave); | ||
}); | ||
it('should be instance of "Error" (parent)', function () { | ||
new ErrorSave().should.be.instanceof(Error); | ||
new ErrorSave().should.not.be.instanceof(SomeObject); | ||
}); | ||
it('should have a name of "ErrorSave"', function () { | ||
new error_save().should.have.property('name').and.equal('ErrorSave'); | ||
new ErrorSave().should.have.property('name').and.equal('ErrorSave'); | ||
}); | ||
it('should have a type of "server"', function () { | ||
new error_save().should.have.property('type').and.equal('server'); | ||
new ErrorSave().should.have.property('type').and.equal('server'); | ||
}); | ||
it('should have a status of 500', function () { | ||
new error_save().should.have.property('status').and.equal(500); | ||
new ErrorSave().should.have.property('status').and.equal(500); | ||
}); | ||
it('should have a message only when one is provided', function () { | ||
new error_save().should.not.have.property('message'); | ||
new error_save('My Message').should.have.property('message').and.equal('My Message'); | ||
it('should update the message when one is provided', function () { | ||
new ErrorSave().should.have.property('message').and.equal(''); | ||
new ErrorSave('My Message').should.have.property('message').and.equal('My Message'); | ||
}); | ||
}); | ||
}); |
@@ -7,24 +7,37 @@ | ||
function SomeObject () { | ||
this.type = 'object'; | ||
} | ||
// Subject | ||
var error_unauthorized = require('../lib/unauthorized.error.js'); | ||
var ErrorUnauthorized = require('../lib/unauthorized.error.js'); | ||
describe('Error - ErrorUnauthorized', function () { | ||
it('should be instance of "ErrorUnauthorized"', function () { | ||
new ErrorUnauthorized().should.be.instanceof(ErrorUnauthorized); | ||
}); | ||
it('should be instance of "Error" (parent)', function () { | ||
new ErrorUnauthorized().should.be.instanceof(Error); | ||
new ErrorUnauthorized().should.not.be.instanceof(SomeObject); | ||
}); | ||
it('should have a name of "ErrorUnauthorized"', function () { | ||
new error_unauthorized().should.have.property('name').and.equal('ErrorUnauthorized'); | ||
new ErrorUnauthorized().should.have.property('name').and.equal('ErrorUnauthorized'); | ||
}); | ||
it('should have a type of "client"', function () { | ||
new error_unauthorized().should.have.property('type').and.equal('client'); | ||
new ErrorUnauthorized().should.have.property('type').and.equal('client'); | ||
}); | ||
it('should have a status of 401', function () { | ||
new error_unauthorized().should.have.property('status').and.equal(401); | ||
new ErrorUnauthorized().should.have.property('status').and.equal(401); | ||
}); | ||
it('should have a message only when one is provided', function () { | ||
new error_unauthorized().should.not.have.property('message'); | ||
new error_unauthorized('My Message').should.have.property('message').and.equal('My Message'); | ||
it('should update the message when one is provided', function () { | ||
new ErrorUnauthorized().should.have.property('message').and.equal(''); | ||
new ErrorUnauthorized('My Message').should.have.property('message').and.equal('My Message'); | ||
}); | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15940
22
393