deno.land / x / ky@v0.31.3 / source / errors / HTTPError.ts
1234567891011121314151617181920212223import type {NormalizedOptions} from '../types/options.js';
// eslint-lint-disable-next-line @typescript-eslint/naming-conventionexport class HTTPError extends Error { public response: Response; public request: Request; public options: NormalizedOptions;
constructor(response: Response, request: Request, options: NormalizedOptions) { 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; }}
Version Info