2018-05-13 00:19:51 +08:00
|
|
|
export enum ErrorCodes {
|
2018-05-29 02:03:12 +08:00
|
|
|
NOT_AUTHENTICATED = 1,
|
|
|
|
ALREADY_AUTHENTICATED = 2,
|
|
|
|
NOT_AUTHORISED = 3,
|
|
|
|
PERMISSION_DENIED = 4,
|
|
|
|
CREDENTIAL_NOT_FOUND = 5,
|
2016-03-20 00:31:42 +08:00
|
|
|
|
|
|
|
|
2018-05-29 02:03:12 +08:00
|
|
|
USER_CREATION_ERROR = 6,
|
2016-03-20 00:31:42 +08:00
|
|
|
|
|
|
|
|
2018-05-29 02:03:12 +08:00
|
|
|
GENERAL_ERROR = 7,
|
|
|
|
THUMBNAIL_GENERATION_ERROR = 8,
|
2019-03-04 04:17:42 +08:00
|
|
|
PERSON_ERROR = 9,
|
|
|
|
SERVER_ERROR = 10,
|
2016-07-07 18:26:36 +08:00
|
|
|
|
2019-03-04 04:17:42 +08:00
|
|
|
USER_MANAGEMENT_DISABLED = 11,
|
2017-07-04 01:17:49 +08:00
|
|
|
|
2019-03-04 04:17:42 +08:00
|
|
|
INPUT_ERROR = 12,
|
2016-05-09 23:04:56 +08:00
|
|
|
|
2019-03-04 04:17:42 +08:00
|
|
|
SETTINGS_ERROR = 13
|
2016-03-19 16:58:27 +08:00
|
|
|
}
|
|
|
|
|
2017-07-15 18:47:11 +08:00
|
|
|
export class ErrorDTO {
|
2017-07-09 20:23:50 +08:00
|
|
|
constructor(public code: ErrorCodes, public message?: string, public details?: any) {
|
2017-06-11 04:32:56 +08:00
|
|
|
}
|
2019-01-27 07:03:40 +08:00
|
|
|
|
|
|
|
toString(): string {
|
|
|
|
return '[' + ErrorCodes[this.code] + '] ' + this.message + (this.details ? this.details.toString() : '');
|
|
|
|
}
|
2017-06-11 04:32:56 +08:00
|
|
|
}
|