add CustomError Class as wrapper for "Error"
throw new CustomError('message','errorCode')
This commit is contained in:
parent
99386b1662
commit
dec3a3070f
|
@ -9,3 +9,21 @@ export interface localized_string {
|
||||||
[k in supported_languages]: string
|
[k in supported_languages]: string
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
export class CustomError extends Error {
|
||||||
|
private code: string
|
||||||
|
public constructor(message: string, errorCode: string) {
|
||||||
|
super(message)
|
||||||
|
this.code = errorCode
|
||||||
|
}
|
||||||
|
public getCode() { return this.code }
|
||||||
|
}
|
||||||
|
export const errorCodes = {
|
||||||
|
no_end_date: 'no_end_date',
|
||||||
|
no_string_present: 'no_string_present',
|
||||||
|
no_schedule: 'no_schedule',
|
||||||
|
schedule_not_supported: 'schedule_not_supported',
|
||||||
|
no_repetition_amount: 'no_repetition_amount',
|
||||||
|
invalid_repetition_string: 'invalid_repetition_string',
|
||||||
|
no_creator_id: "no_creator_id",
|
||||||
|
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue