export class HTTPError extends Error {
    constructor(res, ...x) {
        super(res.statusText);
        this.name = 'HTTPError';
        this.status = res.status;
        // eslint-disable-next-line @typescript-eslint/no-floating-promises
        res.text().then(text => {
            const message = JSON.stringify([...x, text]);
            // eslint-disable-next-line no-console
            console.error(message);
            this.message = message;
        });
    }
}
const isStatusCode = (statusCode) => (error) => {
    return error instanceof HTTPError && error.status === statusCode;
};
export const is404 = isStatusCode(404);
export const is400 = isStatusCode(400);
