1
0
Fork 0

fixed wrong usage of errors

This commit is contained in:
Jan Steemann 2015-08-13 00:17:18 +02:00
parent 7c05077668
commit 5838e8c8aa
2 changed files with 6 additions and 6 deletions

View File

@ -44,7 +44,7 @@ function createAuthenticationMiddleware(auth, applicationContext) {
var users = new Users(applicationContext),
authResult = auth.authenticate(req);
if (authResult.errorNum === errors.ERROR_NO_ERROR) {
if (authResult.errorNum === errors.ERROR_NO_ERROR.code) {
req.currentSession = authResult.session;
req.user = users.get(authResult.session.identifier);
} else {
@ -825,7 +825,7 @@ Sessions.prototype.generate = function (identifier, data) {
} catch (err) {
// we might have generated the same key again
if (err.hasOwnProperty("errorNum") &&
err.errorNum === internal.errors.ERROR_ARANGO_UNIQUE_CONSTRAINT_VIOLATED) {
err.errorNum === internal.errors.ERROR_ARANGO_UNIQUE_CONSTRAINT_VIOLATED.code) {
// duplicate key, try again
continue;
}

View File

@ -639,7 +639,7 @@ function byCondition (data) {
if (typeof condition !== "object" || Array.isArray(condition)) {
// invalid datatype for condition
var err2 = new ArangoError();
err2.errorNum = internal.errors.ERROR_ARANGO_DOCUMENT_TYPE_INVALID;
err2.errorNum = internal.errors.ERROR_ARANGO_DOCUMENT_TYPE_INVALID.code;
err2.errorMessage = "invalid document type";
throw err2;
}
@ -943,7 +943,7 @@ SimpleQueryNear.prototype.execute = function () {
if (this._skip < 0) {
var err = new ArangoError();
err.errorNum = internal.errors.ERROR_BAD_PARAMETER;
err.errorNum = internal.errors.ERROR_BAD_PARAMETER.code;
err.errorMessage = "skip must be non-negative";
throw err;
}
@ -1084,7 +1084,7 @@ SimpleQueryWithin.prototype.execute = function () {
if (this._skip < 0) {
var err = new ArangoError();
err.errorNum = internal.errors.ERROR_BAD_PARAMETER;
err.errorNum = internal.errors.ERROR_BAD_PARAMETER.code;
err.errorMessage = "skip must be non-negative";
throw err;
}
@ -1222,7 +1222,7 @@ SimpleQueryWithinRectangle.prototype.execute = function () {
if (this._skip < 0) {
var err = new ArangoError();
err.errorNum = internal.errors.ERROR_BAD_PARAMETER;
err.errorNum = internal.errors.ERROR_BAD_PARAMETER.code;
err.errorMessage = "skip must be non-negative";
throw err;
}