botbook/node_modules/ky/distribution/errors/HTTPError.js
Rodrigo Rodriguez 6ae15fe3e5 Updated.
2024-09-04 13:13:15 -03:00

17 lines
No EOL
648 B
JavaScript

export class HTTPError extends Error {
response;
request;
options;
constructor(response, request, options) {
const code = (response.status || response.status === 0) ? response.status : '';
const title = response.statusText || '';
const status = `${code} ${title}`.trim();
const reason = status ? `status code ${status}` : 'an unknown error';
super(`Request failed with ${reason}: ${request.method} ${request.url}`);
this.name = 'HTTPError';
this.response = response;
this.request = request;
this.options = options;
}
}
//# sourceMappingURL=HTTPError.js.map