UNPKG

guardz-axios

Version:

Type-safe HTTP client built on top of Axios with runtime validation using guardz. Part of the guardz ecosystem for comprehensive TypeScript type safety.

41 lines 1.56 kB
/** * Error Utilities - Pure functions for error handling * Following Functional Programming (FP) principles */ import { ErrorType, ValidationContext } from "../domain/types"; /** * Categorizes errors by type * Pure function - no side effects, deterministic output */ export declare function categorizeError(error: unknown): ErrorType; /** * Extracts error message from various error types * Pure function - no side effects, deterministic output */ export declare function extractErrorMessage(error: unknown): string; /** * Extracts HTTP status code from error * Pure function - no side effects, deterministic output */ export declare function extractHttpStatusCode(error: unknown): number | undefined; /** * Creates a standardized error message * Pure function - no side effects, deterministic output */ export declare function createStandardErrorMessage(type: ErrorType, message: string, statusCode?: number): string; /** * Formats error for logging * Pure function - no side effects, deterministic output */ export declare function formatErrorForLogging(error: unknown, context?: ValidationContext): string; /** * Determines if error should be logged * Pure function - no side effects, deterministic output */ export declare function shouldLogError(error: unknown): boolean; /** * Creates error context from error object * Pure function - no side effects, deterministic output */ export declare function createErrorContext(error: unknown, url: string, method: string): ValidationContext; //# sourceMappingURL=error-utils.d.ts.map