UNPKG

simple-fetch-ts

Version:

`simple-fetch-ts` is a TypeScript library designed to simplify HTTP requests using a builder-pattern approach. It provides a fluent API for creating, configuring, and executing various HTTP methods (`GET`, `POST`, `PUT`, `PATCH`, `DELETE`) with type safet

16 lines (15 loc) 669 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.SimpleFetchRequestError = void 0; class SimpleFetchRequestError extends Error { constructor(method, url, status, statusText, responseBody) { super(`${method} request to ${url} failed with status ${status !== null && status !== void 0 ? status : "unknown"}: ${statusText || "No status text"}`); this.method = method; this.url = url; this.status = status; this.statusText = statusText; this.responseBody = responseBody; this.name = "SimpleFetchRequestError"; } } exports.SimpleFetchRequestError = SimpleFetchRequestError;