fix tests, move most errors to shared code

This commit is contained in:
Matteo Pagliazzi
2016-03-03 19:16:03 +01:00
parent 80f791c86b
commit 96c582e062
7 changed files with 37 additions and 59 deletions

View File

@@ -1,4 +1,4 @@
import CustomError from '../../../../common/script/api-v3/customError';
import { CustomError } from '../../../../common/script/api-v3/errors';
/**
* @apiDefine NotAuthorized
@@ -11,14 +11,7 @@ import CustomError from '../../../../common/script/api-v3/customError';
* "message": "Not authorized."
* }
*/
export class NotAuthorized extends CustomError {
constructor (customMessage) {
super();
this.name = this.constructor.name;
this.httpCode = 401;
this.message = customMessage || 'Not authorized.';
}
}
export { NotAuthorized } from '../../../../common/script/api-v3/errors';
/**
* @apiDefine BadRequest
@@ -31,14 +24,7 @@ export class NotAuthorized extends CustomError {
* "message": "Bad request."
* }
*/
export class BadRequest extends CustomError {
constructor (customMessage) {
super();
this.name = this.constructor.name;
this.httpCode = 400;
this.message = customMessage || 'Bad request.';
}
}
export { BadRequest } from '../../../../common/script/api-v3/errors';
/**
* @apiDefine NotFound
@@ -51,14 +37,7 @@ export class BadRequest extends CustomError {
* "message": "Not found."
* }
*/
export class NotFound extends CustomError {
constructor (customMessage) {
super();
this.name = this.constructor.name;
this.httpCode = 404;
this.message = customMessage || 'Not found.';
}
}
export { NotFound } from '../../../../common/script/api-v3/errors';
/**
* @apiDefine InternalServerError