sequelize-middleware/libs/ErrorBuilder.js
2020-02-10 16:13:42 +01:00

21 lines
438 B
JavaScript

/**
* Classe permettant la gestion des erreurs personilisées
*/
class ErrorBuilder extends Error {
/**
* @param {Number} errorCode
* @param {Mixed} ...params
*/
constructor(errorCode, ...params) {
super(...params);
if (Error.captureStackTrace) {
Error.captureStackTrace(this, ErrorBuilder);
}
this.errorCode = errorCode.toFixed(1);
this.date = new Date();
}
}
export default ErrorBuilder;