From ac36667dade49bec5d55ae05056c2f483cf23227 Mon Sep 17 00:00:00 2001 From: Damjan Savic Date: Sun, 25 Jan 2026 06:30:49 +0100 Subject: [PATCH] auto-claude: subtask-1-1 - Add JSDoc to errorHandling.ts (AppError class, han --- src/utils/errorHandling.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/utils/errorHandling.ts b/src/utils/errorHandling.ts index 3a6e561..4a8689f 100644 --- a/src/utils/errorHandling.ts +++ b/src/utils/errorHandling.ts @@ -1,5 +1,13 @@ +/** + * Error Handling Utilities + * Centralized error handling and custom error types + */ + import { trackEvent } from './analytics'; +/** + * Custom application error class with error codes, severity levels, and metadata + */ export class AppError extends Error { constructor( message: string, @@ -12,6 +20,9 @@ export class AppError extends Error { } } +/** + * Standard error codes used throughout the application + */ export const errorCodes = { NETWORK_ERROR: 'ERR_NETWORK', API_ERROR: 'ERR_API', @@ -20,6 +31,9 @@ export const errorCodes = { UNKNOWN_ERROR: 'ERR_UNKNOWN' } as const; +/** + * Handle and normalize errors with tracking and logging + */ export const handleError = (error: unknown, context: string) => { let appError: AppError; @@ -52,6 +66,9 @@ export const handleError = (error: unknown, context: string) => { return appError; }; +/** + * Create an API error with HTTP status code + */ export const createAPIError = (status: number, message: string) => { return new AppError( message,