arcx
Version:
A lightweight, dependency-free fetch utility for APIs and React.
29 lines (28 loc) • 692 B
JavaScript
/**
* @module errors
* This module provides error classes and interfaces
* for handling fetch-related errors in ArcX.
*/
/**
* An error class representing HTTP error responses (4xx, 5xx).
*/
export class HTTPError extends Error {
status;
responseBody;
constructor(message, status, responseBody) {
super(message);
this.name = "HTTPError";
this.status = status;
this.responseBody = responseBody;
}
}
/**
* An error class representing network or other unexpected errors
* that are not HTTP errors.
*/
export class NetworkError extends Error {
constructor(message) {
super(message);
this.name = "NetworkError";
}
}