mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 23:27:26 +01:00
fix tests, move most errors to shared code
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user