UNPKG

arcx

Version:

A lightweight, dependency-free fetch utility for APIs and React.

34 lines (33 loc) 874 B
"use strict"; /** * @module errors * This module provides error classes and interfaces * for handling fetch-related errors in ArcX. */ Object.defineProperty(exports, "__esModule", { value: true }); exports.NetworkError = exports.HTTPError = void 0; /** * An error class representing HTTP error responses (4xx, 5xx). */ class HTTPError extends Error { status; responseBody; constructor(message, status, responseBody) { super(message); this.name = "HTTPError"; this.status = status; this.responseBody = responseBody; } } exports.HTTPError = HTTPError; /** * An error class representing network or other unexpected errors * that are not HTTP errors. */ class NetworkError extends Error { constructor(message) { super(message); this.name = "NetworkError"; } } exports.NetworkError = NetworkError;