Files
telegram_glpi/node_modules/glpi-api/errors/ServerError.js
Александр Тороп 038bf44010 init
2024-03-30 18:27:37 +03:00

18 lines
486 B
JavaScript

class ServerError extends Error {
constructor(message, code, comment) {
if (message instanceof Error && message.response) {
code = message.response.statusCode;
comment = message.response.body[1];
message = message.response.body[0];
}
super(message);
this.name = this.constructor.name;
Error.captureStackTrace(this, this.constructor);
this.code = code || 500;
this.comment = comment;
}
}
module.exports = ServerError;