@sap/xssec
Version:
XS Advanced Container Security API for node.js
21 lines (18 loc) • 831 B
JavaScript
const NetworkError = require("./NetworkError");
/**
* An error that occurs while sending a request, e.g. when there is no network connection.
*/
class RequestError extends NetworkError {
/** @type {import("https").RequestOptions & {name: string}} */
request;
/** @type {Error|Error[]} the original error(s) of the HTTP client for debugging. Do not code against this property as the internal HTTP client implementation may change anytime. */
originalError;
constructor(url, request, originalError, message = `HTTP request [${request.name}] to ${url} could not be sent due to: ${originalError.toString()}.`) {
super(message);
this.name = "RequestError";
this.url = url;
this.request = request;
this.originalError = originalError;
}
}
module.exports = RequestError;