sequelize-middleware/libs/ErrorBuilder.js

22 lines
438 B
JavaScript
Raw Normal View History

2020-02-10 16:13:42 +01:00
/**
* 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;