21 lines
329 B
JavaScript
21 lines
329 B
JavaScript
|
'use strict';
|
||
|
|
||
|
class HttpError extends Error {
|
||
|
constructor(message, httpCode, friendlyMessage, data) {
|
||
|
super(message);
|
||
|
|
||
|
this.name = 'HttpError';
|
||
|
this.httpCode = httpCode;
|
||
|
|
||
|
if (friendlyMessage) {
|
||
|
this.friendlyMessage = friendlyMessage;
|
||
|
}
|
||
|
|
||
|
if (data) {
|
||
|
this.data = data;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
module.exports = { HttpError };
|