mirror of
https://gitee.com/dgflash/oops-framework.git
synced 2026-05-12 13:01:31 +08:00
15 lines
644 B
JavaScript
15 lines
644 B
JavaScript
// eslint-lint-disable-next-line @typescript-eslint/naming-convention
|
|
export class HTTPError extends Error {
|
|
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}`);
|
|
this.name = 'HTTPError';
|
|
this.response = response;
|
|
this.request = request;
|
|
this.options = options;
|
|
}
|
|
}
|
|
//# sourceMappingURL=HTTPError.js.map
|