0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-06 22:40:14 -05:00

Merge pull request #5181 from sebgie/issue#5178

Rename error.type to error.errorType
This commit is contained in:
Hannah Wolfe 2015-04-22 22:00:08 +01:00
commit 3d5fe130c2
26 changed files with 106 additions and 106 deletions

View file

@ -166,7 +166,7 @@ formatHttpErrors = function (error) {
errorContent.message = _.isString(errorItem) ? errorItem :
(_.isObject(errorItem) ? errorItem.message : 'Unknown API Error');
errorContent.type = errorItem.type || 'InternalServerError';
errorContent.errorType = errorItem.errorType || 'InternalServerError';
errors.push(errorContent);
});

View file

@ -245,7 +245,7 @@ users = {
}).then(function () {
return Promise.resolve({users: [user]});
}).catch(function (error) {
if (error && error.type === 'EmailError') {
if (error && error.errorType === 'EmailError') {
error.message = 'Error sending email: ' + error.message + ' Please check your email settings and resend the invitation.';
errors.logWarn(error.message);

View file

@ -402,7 +402,7 @@ frontendControllers = {
// If we've thrown an error message
// of type: 'NotFound' then we found
// no path match.
if (err.type === 'NotFoundError') {
if (err.errorType === 'NotFoundError') {
return next();
}

View file

@ -5,7 +5,7 @@ function BadRequestError(message) {
this.message = message;
this.stack = new Error().stack;
this.code = 400;
this.type = this.name;
this.errorType = this.name;
}
BadRequestError.prototype = Object.create(Error.prototype);

View file

@ -5,7 +5,7 @@ function DataImportError(message, offendingProperty, value) {
this.message = message;
this.stack = new Error().stack;
this.code = 500;
this.type = this.name;
this.errorType = this.name;
this.property = offendingProperty || undefined;
this.value = value || undefined;
}

View file

@ -5,7 +5,7 @@ function EmailError(message) {
this.message = message;
this.stack = new Error().stack;
this.code = 500;
this.type = this.name;
this.errorType = this.name;
}
EmailError.prototype = Object.create(Error.prototype);

View file

@ -189,14 +189,14 @@ errors = {
return this.rejectError(new this.NoPermissionError(error));
}
if (error.type) {
if (error.errorType) {
return this.rejectError(error);
}
// handle database errors
if (error.code && (error.errno || error.detail)) {
error.db_error_code = error.code;
error.type = 'DatabaseError';
error.errorType = 'DatabaseError';
error.code = 500;
return this.rejectError(error);
@ -323,7 +323,7 @@ errors = {
errorContent.message = _.isString(errorItem) ? errorItem :
(_.isObject(errorItem) ? errorItem.message : 'Unknown Error');
errorContent.type = errorItem.type || 'InternalServerError';
errorContent.errorType = errorItem.errorType || 'InternalServerError';
returnErrors.push(errorContent);
});

View file

@ -5,7 +5,7 @@ function InternalServerError(message) {
this.message = message;
this.stack = new Error().stack;
this.code = 500;
this.type = this.name;
this.errorType = this.name;
}
InternalServerError.prototype = Object.create(Error.prototype);

View file

@ -5,7 +5,7 @@ function NoPermissionError(message) {
this.message = message;
this.stack = new Error().stack;
this.code = 403;
this.type = this.name;
this.errorType = this.name;
}
NoPermissionError.prototype = Object.create(Error.prototype);

View file

@ -5,7 +5,7 @@ function NotFoundError(message) {
this.message = message;
this.stack = new Error().stack;
this.code = 404;
this.type = this.name;
this.errorType = this.name;
}
NotFoundError.prototype = Object.create(Error.prototype);

View file

@ -5,7 +5,7 @@ function RequestEntityTooLargeError(message) {
this.message = message;
this.stack = new Error().stack;
this.code = 413;
this.type = this.name;
this.errorType = this.name;
}
RequestEntityTooLargeError.prototype = Object.create(Error.prototype);

View file

@ -5,7 +5,7 @@ function UnauthorizedError(message) {
this.message = message;
this.stack = new Error().stack;
this.code = 401;
this.type = this.name;
this.errorType = this.name;
}
UnauthorizedError.prototype = Object.create(Error.prototype);

View file

@ -5,7 +5,7 @@ function UnsupportedMediaTypeError(message) {
this.message = message;
this.stack = new Error().stack;
this.code = 415;
this.type = this.name;
this.errorType = this.name;
}
UnsupportedMediaTypeError.prototype = Object.create(Error.prototype);

View file

@ -8,7 +8,7 @@ function ValidationError(message, offendingProperty) {
if (offendingProperty) {
this.property = offendingProperty;
}
this.type = this.name;
this.errorType = this.name;
}
ValidationError.prototype = Object.create(Error.prototype);

View file

@ -64,8 +64,8 @@ describe('Authentication API', function () {
return done(err);
}
var jsonResponse = res.body;
should.exist(jsonResponse.errors[0].type);
jsonResponse.errors[0].type.should.eql('NotFoundError');
should.exist(jsonResponse.errors[0].errorType);
jsonResponse.errors[0].errorType.should.eql('NotFoundError');
done();
});
});
@ -81,8 +81,8 @@ describe('Authentication API', function () {
return done(err);
}
var jsonResponse = res.body;
should.exist(jsonResponse.errors[0].type);
jsonResponse.errors[0].type.should.eql('UnauthorizedError');
should.exist(jsonResponse.errors[0].errorType);
jsonResponse.errors[0].errorType.should.eql('UnauthorizedError');
done();
});
});
@ -128,8 +128,8 @@ describe('Authentication API', function () {
return done(err);
}
var jsonResponse = res.body;
should.exist(jsonResponse.errors[0].type);
jsonResponse.errors[0].type.should.eql('NoPermissionError');
should.exist(jsonResponse.errors[0].errorType);
jsonResponse.errors[0].errorType.should.eql('NoPermissionError');
done();
});
});

View file

@ -298,7 +298,7 @@ describe('Post API', function () {
var jsonResponse = res.body;
jsonResponse.should.exist;
jsonResponse.errors.should.exist;
testUtils.API.checkResponseValue(jsonResponse.errors[0], ['message', 'type']);
testUtils.API.checkResponseValue(jsonResponse.errors[0], ['message', 'errorType']);
done();
});
});
@ -318,7 +318,7 @@ describe('Post API', function () {
var jsonResponse = res.body;
jsonResponse.should.exist;
jsonResponse.errors.should.exist;
testUtils.API.checkResponseValue(jsonResponse.errors[0], ['message', 'type']);
testUtils.API.checkResponseValue(jsonResponse.errors[0], ['message', 'errorType']);
done();
});
});
@ -338,7 +338,7 @@ describe('Post API', function () {
var jsonResponse = res.body;
jsonResponse.should.exist;
jsonResponse.errors.should.exist;
testUtils.API.checkResponseValue(jsonResponse.errors[0], ['message', 'type']);
testUtils.API.checkResponseValue(jsonResponse.errors[0], ['message', 'errorType']);
done();
});
});
@ -677,7 +677,7 @@ describe('Post API', function () {
should.not.exist(res.headers['x-cache-invalidate']);
jsonResponse = res.body;
jsonResponse.errors.should.exist;
testUtils.API.checkResponseValue(jsonResponse.errors[0], ['message', 'type']);
testUtils.API.checkResponseValue(jsonResponse.errors[0], ['message', 'errorType']);
done();
});
});
@ -813,7 +813,7 @@ describe('Post API', function () {
should.not.exist(res.headers['x-cache-invalidate']);
jsonResponse = res.body;
jsonResponse.errors.should.exist;
testUtils.API.checkResponseValue(jsonResponse.errors[0], ['message', 'type']);
testUtils.API.checkResponseValue(jsonResponse.errors[0], ['message', 'errorType']);
done();
});
});
@ -859,7 +859,7 @@ describe('Post API', function () {
var jsonResponse = res.body;
jsonResponse.should.exist;
jsonResponse.errors.should.exist;
testUtils.API.checkResponseValue(jsonResponse.errors[0], ['message', 'type']);
testUtils.API.checkResponseValue(jsonResponse.errors[0], ['message', 'errorType']);
done();
});
});

View file

@ -93,7 +93,7 @@ describe('Settings API', function () {
var jsonResponse = res.body;
jsonResponse.should.exist;
jsonResponse.errors.should.exist;
testUtils.API.checkResponseValue(jsonResponse.errors[0], ['message', 'type']);
testUtils.API.checkResponseValue(jsonResponse.errors[0], ['message', 'errorType']);
done();
});
});
@ -200,7 +200,7 @@ describe('Settings API', function () {
jsonResponse = res.body;
should.not.exist(res.headers['x-cache-invalidate']);
jsonResponse.errors.should.exist;
testUtils.API.checkResponseValue(jsonResponse.errors[0], ['message', 'type']);
testUtils.API.checkResponseValue(jsonResponse.errors[0], ['message', 'errorType']);
done();
});
});

View file

@ -282,7 +282,7 @@ describe('User API', function () {
var jsonResponse = res.body;
jsonResponse.should.exist;
jsonResponse.errors.should.exist;
testUtils.API.checkResponseValue(jsonResponse.errors[0], ['message', 'type']);
testUtils.API.checkResponseValue(jsonResponse.errors[0], ['message', 'errorType']);
done();
});
});
@ -302,7 +302,7 @@ describe('User API', function () {
var jsonResponse = res.body;
jsonResponse.should.exist;
jsonResponse.errors.should.exist;
testUtils.API.checkResponseValue(jsonResponse.errors[0], ['message', 'type']);
testUtils.API.checkResponseValue(jsonResponse.errors[0], ['message', 'errorType']);
done();
});
});

View file

@ -58,17 +58,17 @@ describe('DB API', function () {
return dbAPI.deleteAllContent(testUtils.context.editor).then(function () {
done(new Error('Delete all content is not denied for editor.'));
}, function (error) {
error.type.should.eql('NoPermissionError');
error.errorType.should.eql('NoPermissionError');
return dbAPI.deleteAllContent(testUtils.context.author);
}).then(function () {
done(new Error('Delete all content is not denied for author.'));
}, function (error) {
error.type.should.eql('NoPermissionError');
error.errorType.should.eql('NoPermissionError');
return dbAPI.deleteAllContent();
}).then(function () {
done(new Error('Delete all content is not denied without authentication.'));
}).catch(function (error) {
error.type.should.eql('NoPermissionError');
error.errorType.should.eql('NoPermissionError');
done();
}).catch(done);
});
@ -77,17 +77,17 @@ describe('DB API', function () {
return dbAPI.exportContent(testUtils.context.editor).then(function () {
done(new Error('Export content is not denied for editor.'));
}, function (error) {
error.type.should.eql('NoPermissionError');
error.errorType.should.eql('NoPermissionError');
return dbAPI.exportContent(testUtils.context.author);
}).then(function () {
done(new Error('Export content is not denied for author.'));
}, function (error) {
error.type.should.eql('NoPermissionError');
error.errorType.should.eql('NoPermissionError');
return dbAPI.exportContent();
}).then(function () {
done(new Error('Export content is not denied without authentication.'));
}).catch(function (error) {
error.type.should.eql('NoPermissionError');
error.errorType.should.eql('NoPermissionError');
done();
}).catch(done);
});
@ -96,17 +96,17 @@ describe('DB API', function () {
return dbAPI.importContent(testUtils.context.editor).then(function () {
done(new Error('Import content is not denied for editor.'));
}, function (error) {
error.type.should.eql('NoPermissionError');
error.errorType.should.eql('NoPermissionError');
return dbAPI.importContent(testUtils.context.author);
}).then(function () {
done(new Error('Import content is not denied for author.'));
}, function (error) {
error.type.should.eql('NoPermissionError');
error.errorType.should.eql('NoPermissionError');
return dbAPI.importContent();
}).then(function () {
done(new Error('Import content is not denied without authentication.'));
}).catch(function (error) {
error.type.should.eql('NoPermissionError');
error.errorType.should.eql('NoPermissionError');
done();
}).catch(done);
});

View file

@ -51,7 +51,7 @@ describe('Mail API', function () {
done();
}).catch(function (error) {
error.message.should.eql('Email Error: No e-mail transport configured.');
error.type.should.eql('EmailError');
error.errorType.should.eql('EmailError');
done();
}).catch(done);
});
@ -62,7 +62,7 @@ describe('Mail API', function () {
done();
}).catch(function (error) {
error.message.should.eql('Email Error: No e-mail transport configured.');
error.type.should.eql('EmailError');
error.errorType.should.eql('EmailError');
done();
}).catch(done);
});
@ -83,7 +83,7 @@ describe('Mail API', function () {
done(new Error('Error message not shown.'));
}, function (error) {
error.message.should.startWith('Email Error: Failed sending email');
error.type.should.eql('EmailError');
error.errorType.should.eql('EmailError');
done();
}).catch(done);
});
@ -95,7 +95,7 @@ describe('Mail API', function () {
done(new Error('Error message not shown.'));
}, function (error) {
error.message.should.eql('Email Error: Failed sending email.');
error.type.should.eql('EmailError');
error.errorType.should.eql('EmailError');
done();
}).catch(done);
});
@ -107,7 +107,7 @@ describe('Mail API', function () {
done(new Error('Error message not shown.'));
}, function (error) {
error.message.should.eql('Email Error: Incomplete message data.');
error.type.should.eql('EmailError');
error.errorType.should.eql('EmailError');
done();
}).catch(done);
});
@ -141,7 +141,7 @@ describe('Mail API', function () {
done(new Error('Stub did not error'));
}, function (error) {
error.message.should.startWith('Email Error: Failed sending email: there is no mail server at this address');
error.type.should.eql('EmailError');
error.errorType.should.eql('EmailError');
done();
}).catch(done);
});

View file

@ -107,7 +107,7 @@ describe('Settings API', function () {
done(new Error('Allowed to read databaseVersion with external request'));
}).catch(function (error) {
should.exist(error);
error.type.should.eql('NoPermissionError');
error.errorType.should.eql('NoPermissionError');
done();
}).catch(done);
});
@ -153,7 +153,7 @@ describe('Settings API', function () {
}).catch(function (err) {
should.exist(err);
err.type.should.eql('NoPermissionError');
err.errorType.should.eql('NoPermissionError');
done();
}).catch(done);
@ -191,7 +191,7 @@ describe('Settings API', function () {
}).catch(function (err) {
should.exist(err);
err.type.should.eql('ValidationError');
err.errorType.should.eql('ValidationError');
done();
}).catch(done);

View file

@ -67,7 +67,7 @@ describe('Slug API', function () {
.then(function () {
done(new Error('Generate a slug for an unknown type is not rejected.'));
}).catch(function (error) {
error.type.should.equal('BadRequestError');
error.errorType.should.equal('BadRequestError');
done();
}).catch(done);
});

View file

@ -43,7 +43,7 @@ describe('Upload API', function () {
done(new Error('Upload suceeded with invalid file.'));
}, function (result) {
result.code.should.equal(415);
result.type.should.equal('UnsupportedMediaTypeError');
result.errorType.should.equal('UnsupportedMediaTypeError');
done();
});
});
@ -60,7 +60,7 @@ describe('Upload API', function () {
done(new Error('Upload suceeded with invalid file.'));
}, function (result) {
result.code.should.equal(415);
result.type.should.equal('UnsupportedMediaTypeError');
result.errorType.should.equal('UnsupportedMediaTypeError');
done();
});
});
@ -89,7 +89,7 @@ describe('Upload API', function () {
done(new Error('Upload suceeded with invalid file.'));
}, function (result) {
result.code.should.equal(415);
result.type.should.equal('UnsupportedMediaTypeError');
result.errorType.should.equal('UnsupportedMediaTypeError');
done();
});
});

View file

@ -212,7 +212,7 @@ describe('Users API', function () {
.then(function () {
done(new Error('ID mismatches should not be permitted'));
}).catch(function (error) {
error.type.should.eql('BadRequestError');
error.errorType.should.eql('BadRequestError');
done();
});
});
@ -284,7 +284,7 @@ describe('Users API', function () {
).then(function () {
done(new Error('Editor should not be able to edit owner account'));
}).catch(function (error) {
error.type.should.eql('NoPermissionError');
error.errorType.should.eql('NoPermissionError');
}).finally(function () {
// Cannot edit Admin
UserAPI.edit(
@ -292,7 +292,7 @@ describe('Users API', function () {
).then(function () {
done(new Error('Editor should not be able to edit admin account'));
}).catch(function (error) {
error.type.should.eql('NoPermissionError');
error.errorType.should.eql('NoPermissionError');
}).finally(function () {
// Cannot edit Editor
UserAPI.edit(
@ -300,7 +300,7 @@ describe('Users API', function () {
).then(function () {
done(new Error('Editor should not be able to edit other editor account'));
}).catch(function (error) {
error.type.should.eql('NoPermissionError');
error.errorType.should.eql('NoPermissionError');
done();
});
});
@ -330,7 +330,7 @@ describe('Users API', function () {
).then(function () {
done(new Error('Editor should not be able to edit owner account'));
}).catch(function (error) {
error.type.should.eql('NoPermissionError');
error.errorType.should.eql('NoPermissionError');
}).finally(function () {
// Cannot edit admin
UserAPI.edit(
@ -338,14 +338,14 @@ describe('Users API', function () {
).then(function () {
done(new Error('Editor should not be able to edit admin account'));
}).catch(function (error) {
error.type.should.eql('NoPermissionError');
error.errorType.should.eql('NoPermissionError');
}).finally(function () {
UserAPI.edit(
{users: [{name: newName}]}, _.extend({}, context.author, {id: userIdFor.author2})
).then(function () {
done(new Error('Author should not be able to edit author account which is not their own'));
}).catch(function (error) {
error.type.should.eql('NoPermissionError');
error.errorType.should.eql('NoPermissionError');
done();
});
});
@ -418,7 +418,7 @@ describe('Users API', function () {
.then(function () {
done(new Error('Owner should not be able to add an owner'));
}).catch(function (error) {
error.type.should.eql('NoPermissionError');
error.errorType.should.eql('NoPermissionError');
done();
});
});
@ -491,7 +491,7 @@ describe('Users API', function () {
.then(function () {
done(new Error('Admin should not be able to add an owner'));
}).catch(function (error) {
error.type.should.eql('NoPermissionError');
error.errorType.should.eql('NoPermissionError');
done();
});
});
@ -561,7 +561,7 @@ describe('Users API', function () {
.then(function () {
done(new Error('Editor should not be able to add an owner'));
}).catch(function (error) {
error.type.should.eql('NoPermissionError');
error.errorType.should.eql('NoPermissionError');
done();
});
});
@ -586,7 +586,7 @@ describe('Users API', function () {
.then(function () {
done(new Error('Author should not be able to add an owner'));
}).catch(function (error) {
error.type.should.eql('NoPermissionError');
error.errorType.should.eql('NoPermissionError');
done();
});
});
@ -597,7 +597,7 @@ describe('Users API', function () {
.then(function () {
done(new Error('Author should not be able to add an author'));
}).catch(function (error) {
error.type.should.eql('NoPermissionError');
error.errorType.should.eql('NoPermissionError');
done();
});
});
@ -620,7 +620,7 @@ describe('Users API', function () {
.then(function () {
done(new Error('Owner should not be able to delete itself'));
}).catch(function (error) {
error.type.should.eql('NoPermissionError');
error.errorType.should.eql('NoPermissionError');
done();
});
});
@ -651,7 +651,7 @@ describe('Users API', function () {
.then(function () {
done(new Error('Admin should not be able to delete owner'));
}).catch(function (error) {
error.type.should.eql('NoPermissionError');
error.errorType.should.eql('NoPermissionError');
done();
});
});
@ -683,7 +683,7 @@ describe('Users API', function () {
.then(function () {
done(new Error('Editor should not be able to delete owner'));
}).catch(function (error) {
error.type.should.eql('NoPermissionError');
error.errorType.should.eql('NoPermissionError');
done();
});
});
@ -693,7 +693,7 @@ describe('Users API', function () {
.then(function () {
done(new Error('Editor should not be able to delete admin'));
}).catch(function (error) {
error.type.should.eql('NoPermissionError');
error.errorType.should.eql('NoPermissionError');
done();
});
});
@ -703,7 +703,7 @@ describe('Users API', function () {
.then(function () {
done(new Error('Editor should not be able to delete other editor'));
}).catch(function (error) {
error.type.should.eql('NoPermissionError');
error.errorType.should.eql('NoPermissionError');
done();
});
});
@ -731,7 +731,7 @@ describe('Users API', function () {
.then(function () {
done(new Error('Author should not be able to delete owner'));
}).catch(function (error) {
error.type.should.eql('NoPermissionError');
error.errorType.should.eql('NoPermissionError');
done();
});
});
@ -741,7 +741,7 @@ describe('Users API', function () {
.then(function () {
done(new Error('Author should not be able to delete admin'));
}).catch(function (error) {
error.type.should.eql('NoPermissionError');
error.errorType.should.eql('NoPermissionError');
done();
});
});
@ -751,7 +751,7 @@ describe('Users API', function () {
.then(function () {
done(new Error('Author should not be able to delete editor'));
}).catch(function (error) {
error.type.should.eql('NoPermissionError');
error.errorType.should.eql('NoPermissionError');
done();
});
});
@ -761,7 +761,7 @@ describe('Users API', function () {
.then(function () {
done(new Error('Author should not be able to delete other author'));
}).catch(function (error) {
error.type.should.eql('NoPermissionError');
error.errorType.should.eql('NoPermissionError');
done();
});
});
@ -771,7 +771,7 @@ describe('Users API', function () {
.then(function () {
done(new Error('Author should not be able to delete self'));
}).catch(function (error) {
error.type.should.eql('NoPermissionError');
error.errorType.should.eql('NoPermissionError');
done();
});
});
@ -797,7 +797,7 @@ describe('Users API', function () {
.then(function () {
done(new Error('ID mismatches should not be permitted'));
}).catch(function (error) {
error.type.should.eql('BadRequestError');
error.errorType.should.eql('BadRequestError');
done();
});
});
@ -936,7 +936,7 @@ describe('Users API', function () {
}, options).then(function () {
done(new Error('Author should not be able to downgrade owner'));
}).catch(function (error) {
error.type.should.eql('NoPermissionError');
error.errorType.should.eql('NoPermissionError');
done();
}).catch(done);
});
@ -964,7 +964,7 @@ describe('Users API', function () {
).then(function () {
done(new Error('Editor should not be able to upgrade their role'));
}, function (error) {
error.type.should.eql('NoPermissionError');
error.errorType.should.eql('NoPermissionError');
done();
}).catch(done);
});
@ -976,7 +976,7 @@ describe('Users API', function () {
).then(function () {
done(new Error('Editor should not be able to change the roles of other editors'));
}, function (error) {
error.type.should.eql('NoPermissionError');
error.errorType.should.eql('NoPermissionError');
done();
}).catch(done);
});
@ -988,7 +988,7 @@ describe('Users API', function () {
).then(function () {
done(new Error('Editor should not be able to change the roles of admins'));
}, function (error) {
error.type.should.eql('NoPermissionError');
error.errorType.should.eql('NoPermissionError');
done();
}).catch(done);
});
@ -999,7 +999,7 @@ describe('Users API', function () {
).then(function () {
done(new Error('Editor should not be able to upgrade the role of authors'));
}).catch(function (error) {
error.type.should.eql('NoPermissionError');
error.errorType.should.eql('NoPermissionError');
done();
}).catch(done);
});
@ -1013,7 +1013,7 @@ describe('Users API', function () {
).then(function () {
done(new Error('Author should not be able to upgrade their role'));
}, function (error) {
error.type.should.eql('NoPermissionError');
error.errorType.should.eql('NoPermissionError');
done();
}).catch(done);
});
@ -1045,7 +1045,7 @@ describe('Users API', function () {
).then(function () {
done(new Error('Owner should not be able to downgrade their role'));
}).catch(function (error) {
error.type.should.eql('ValidationError');
error.errorType.should.eql('ValidationError');
done();
});
});
@ -1058,7 +1058,7 @@ describe('Users API', function () {
).then(function () {
done(new Error('Admin is not denied transferring ownership.'));
}).catch(function (error) {
error.type.should.eql('NoPermissionError');
error.errorType.should.eql('NoPermissionError');
done();
});
});
@ -1071,7 +1071,7 @@ describe('Users API', function () {
).then(function () {
done(new Error('Admin is not denied transferring ownership.'));
}).catch(function (error) {
error.type.should.eql('NoPermissionError');
error.errorType.should.eql('NoPermissionError');
done();
});
});
@ -1084,7 +1084,7 @@ describe('Users API', function () {
).then(function () {
done(new Error('Admin is not denied transferring ownership.'));
}).catch(function (error) {
error.type.should.eql('NoPermissionError');
error.errorType.should.eql('NoPermissionError');
done();
});
});
@ -1120,7 +1120,7 @@ describe('Users API', function () {
.then(function () {
done(new Error('Password change is not denied.'));
}).catch(function (error) {
error.type.should.eql('ValidationError');
error.errorType.should.eql('ValidationError');
done();
});
});
@ -1138,7 +1138,7 @@ describe('Users API', function () {
.then(function () {
done(new Error('Password change is not denied.'));
}).catch(function (error) {
error.type.should.eql('ValidationError');
error.errorType.should.eql('ValidationError');
done();
});
});
@ -1155,7 +1155,7 @@ describe('Users API', function () {
.then(function () {
done(new Error('Password change is not denied.'));
}).catch(function (error) {
error.type.should.eql('ValidationError');
error.errorType.should.eql('ValidationError');
done();
});
});
@ -1172,7 +1172,7 @@ describe('Users API', function () {
.then(function () {
done(new Error('Password change is not denied.'));
}).catch(function (error) {
error.type.should.eql('ValidationError');
error.errorType.should.eql('ValidationError');
done();
});
});
@ -1204,7 +1204,7 @@ describe('Users API', function () {
.then(function () {
done(new Error('Password change is not denied.'));
}).catch(function (error) {
error.type.should.eql('NoPermissionError');
error.errorType.should.eql('NoPermissionError');
done();
});
});

View file

@ -257,7 +257,7 @@ describe('Import', function () {
(1).should.eql(0, 'Data import should not resolve promise.');
}, function (error) {
error[0].message.should.eql('Value in [posts.title] exceeds maximum length of 150 characters.');
error[0].type.should.eql('ValidationError');
error[0].errorType.should.eql('ValidationError');
Promise.all([
knex('users').select(),
@ -302,7 +302,7 @@ describe('Import', function () {
(1).should.eql(0, 'Data import should not resolve promise.');
}, function (error) {
error[0].message.should.eql('Value in [settings.key] cannot be blank.');
error[0].type.should.eql('ValidationError');
error[0].errorType.should.eql('ValidationError');
Promise.all([
knex('users').select(),
@ -429,7 +429,7 @@ describe('Import', function () {
(1).should.eql(0, 'Data import should not resolve promise.');
}, function (error) {
error[0].message.should.eql('Value in [posts.title] exceeds maximum length of 150 characters.');
error[0].type.should.eql('ValidationError');
error[0].errorType.should.eql('ValidationError');
Promise.all([
knex('users').select(),
@ -473,7 +473,7 @@ describe('Import', function () {
(1).should.eql(0, 'Data import should not resolve promise.');
}, function (error) {
error[0].message.should.eql('Value in [settings.key] cannot be blank.');
error[0].type.should.eql('ValidationError');
error[0].errorType.should.eql('ValidationError');
Promise.all([
knex('users').select(),
@ -567,15 +567,15 @@ describe('Import', function () {
done(new Error('Allowed import of duplicate data'));
}).catch(function (response) {
response.length.should.equal(5);
response[0].type.should.equal('ValidationError');
response[0].errorType.should.equal('ValidationError');
response[0].message.should.eql('Value in [posts.title] cannot be blank.');
response[1].type.should.equal('ValidationError');
response[1].errorType.should.equal('ValidationError');
response[1].message.should.eql('Value in [posts.slug] cannot be blank.');
response[2].type.should.equal('ValidationError');
response[2].errorType.should.equal('ValidationError');
response[2].message.should.eql('Value in [settings.key] cannot be blank.');
response[3].type.should.equal('ValidationError');
response[3].errorType.should.equal('ValidationError');
response[3].message.should.eql('Value in [tags.slug] cannot be blank.');
response[4].type.should.equal('ValidationError');
response[4].errorType.should.equal('ValidationError');
response[4].message.should.eql('Value in [tags.name] cannot be blank.');
done();
}).catch(done);
@ -590,7 +590,7 @@ describe('Import', function () {
done(new Error('Allowed import of duplicate data'));
}).catch(function (response) {
response.length.should.be.above(0);
response[0].type.should.equal('DataImportError');
response[0].errorType.should.equal('DataImportError');
done();
}).catch(done);
});
@ -607,7 +607,7 @@ describe('Import', function () {
}).catch(function (response) {
response.length.should.equal(1);
response[0].message.should.eql('Attempting to import data linked to unknown user id 2');
response[0].type.should.equal('DataImportError');
response[0].errorType.should.equal('DataImportError');
done();
}).catch(done);
@ -627,9 +627,9 @@ describe('Import', function () {
done(new Error('Allowed import of invalid tags data'));
}).catch(function (response) {
response.length.should.equal(2);
response[0].type.should.equal('ValidationError');
response[0].errorType.should.equal('ValidationError');
response[0].message.should.eql('Value in [tags.name] cannot be blank.');
response[1].type.should.equal('ValidationError');
response[1].errorType.should.equal('ValidationError');
response[1].message.should.eql('Value in [tags.slug] cannot be blank.');
done();
}).catch(done);

View file

@ -335,7 +335,7 @@ describe('Importer', function () {
JSONHandler.loadFile(file).then(function () {
done(new Error('Didn\'t error for bad db api wrapper'));
}).catch(function (response) {
response.type.should.equal('BadRequestError');
response.errorType.should.equal('BadRequestError');
done();
}).catch(done);
});