16 lines
434 B
JavaScript
16 lines
434 B
JavaScript
|
'use strict';
|
||
|
|
||
|
class ServerRequestError extends Error {
|
||
|
constructor (message, code, description) {
|
||
|
super(message);
|
||
|
|
||
|
this.statusCode = code;
|
||
|
this.description = description;
|
||
|
this.name = this.constructor.name;
|
||
|
|
||
|
// capturing the stack trace keeps the reference to your error class
|
||
|
Error.captureStackTrace(this, this.constructor);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
module.exports.ServerRequestError = ServerRequestError;
|