etherpad-lite/src/node/utils/customError.js
2021-01-25 22:53:11 -05:00

24 lines
548 B
JavaScript

'use strict';
/**
* CustomError
*
* This helper modules allows us to create different type of errors we can throw
*
* @class CustomError
* @extends {Error}
*/
class CustomError extends Error {
/**
* Creates an instance of CustomError.
* @param {*} message
* @param {string} [name='Error'] a custom name for the error object
* @memberof CustomError
*/
constructor(message, name = 'Error') {
super(message);
this.name = name;
Error.captureStackTrace(this, this.constructor);
}
}
module.exports = CustomError;