UNPKG

@sap/xssec

Version:

XS Advanced Container Security API for node.js

46 lines (37 loc) 1.21 kB
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; #url; 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; } get url() { return this.#url; } set url(value) { this.#url = value; } get request() { return this.#request; } set request(value) { this.#request = value; } get originalError() { return this.#originalError; } set originalError(error) { this.#originalError = error; } } module.exports = RequestError;