mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-02-01 11:22:41 +01:00
3edd727a94
The previous syntax caused a deprecation warning on Node 10. However, due to the very old version of log4js Etherpad is currently using, customError objects are going to be displayed as { inspect: [Function: inspect] }. This needs to be addressed later, updating log4js. Fixes #3834.
23 lines
534 B
JavaScript
23 lines
534 B
JavaScript
/**
|
|
* 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;
|