UNPKG

@coolio/http

Version:
12 lines 557 B
const symbol = Symbol('HttpResponseError'); export class HttpResponseError extends Error { constructor(response, message) { super(`${response.status} ${response.statusText}: ${response.url}${message ? `, ${message}` : ''}`); this.response = response; this.__symbol = symbol; this.status = response.status; this.name = 'HttpResponseError'; } } export const isHttpResponseError = (error) => (error === null || error === void 0 ? void 0 : error.__symbol) === symbol; //# sourceMappingURL=httpResponseError.js.map