import { Resource, ResourceError } from "@ldo/connected"; //#region src/requester/results/error/HttpErrorResult.d.ts /** * A set of standard errors that can be returned as a result of an HTTP request */ type HttpErrorResultType = ServerHttpError | UnexpectedHttpError | UnauthenticatedHttpError | UnauthorizedHttpError; /** * An error caused by an HTTP request */ declare abstract class HttpErrorResult extends ResourceError { /** * The status of the HTTP request */ readonly status: number; /** * Headers returned by the HTTP request */ readonly headers: Headers; /** * Response returned by the HTTP request */ readonly response: Response; /** * @param resource - the resource * @param response - The response returned by the HTTP requests * @param message - A custom message for the error */ constructor(resource: ResourceType, response: Response, message?: string); /** * Checks to see if a given response does not constitute an HTTP Error * @param response - The response of the request * @returns true if the response does not constitute an HTTP Error */ static isnt(response: Response): boolean; /** * Checks a given response to see if it is a ServerHttpError, an * UnauthenticatedHttpError or a some unexpected error. * @param uri - The uri of the request * @param response - The response of the request * @returns An error if the response calls for it. Undefined if not. */ static checkResponse(resource: ResourceType, response: Response): HttpErrorResultType | undefined; } /** * An unexpected error as a result of an HTTP request. This is usually returned * when the HTTP request returns a status code LDO does not recognize. */ declare class UnexpectedHttpError extends HttpErrorResult { readonly type: "unexpectedHttpError"; } /** * An UnauthenticatedHttpError triggers when a Solid server returns a 401 status * indicating that the request is not authenticated. */ declare class UnauthenticatedHttpError extends HttpErrorResult { readonly type: "unauthenticatedError"; /** * Indicates if a specific response constitutes an UnauthenticatedHttpError * @param response - The request response * @returns true if this response constitutes an UnauthenticatedHttpError */ static is(response: Response): boolean; } /** * An UnauthenticatedHttpError triggers when a Solid server returns a 403 status * indicating that the request is not authorized. */ declare class UnauthorizedHttpError extends HttpErrorResult { readonly type: "unauthorizedError"; /** * Indicates if a specific response constitutes an UnauthenticatedHttpError * @param response - The request response * @returns true if this response constitutes an UnauthenticatedHttpError */ static is(response: Response): boolean; } /** * An NotFoundHttpError triggers when a Solid server returns a 404 status. This * error is not returned in most cases as a "absent" resource is not considered * an error, but it is thrown while trying for find a WAC rule for a resource * that does not exist. */ declare class NotFoundHttpError extends HttpErrorResult { readonly type: "notFoundError"; /** * Indicates if a specific response constitutes an NotFoundHttpError * @param response - The request response * @returns true if this response constitutes an NotFoundHttpError */ static is(response: Response): boolean; } /** * A ServerHttpError triggers when a Solid server returns a 5XX status, * indicating that an error happened on the server. */ declare class ServerHttpError extends HttpErrorResult { readonly type: "serverError"; /** * Indicates if a specific response constitutes a ServerHttpError * @param response - The request response * @returns true if this response constitutes a ServerHttpError */ static is(response: Response): boolean; } //#endregion export { HttpErrorResult, HttpErrorResultType, NotFoundHttpError, ServerHttpError, UnauthenticatedHttpError, UnauthorizedHttpError, UnexpectedHttpError }; //# sourceMappingURL=HttpErrorResult.d.cts.map