@orchard9ai/error-handling
Version:
Federated error handling package with go-core-http-toolkit format support and logging integration
95 lines (85 loc) • 1.85 kB
text/typescript
/**
* @orchard9ai/error-handling - Federated error handling package
*
* Provides standardized error handling for go-core-http-toolkit API format
* with integrated logging and user-friendly error transformation.
*/
// Core exports
export { ErrorHandler } from './core/ErrorHandler.js';
// Specialized handlers
export {
ApiErrorHandler,
ApiRequestError,
getGlobalApiErrorHandler,
configureGlobalApiErrorHandler,
handleApiError,
handleFetchError
} from './handlers/ApiErrorHandler.js';
// HTTP Client
export {
HttpClient,
HttpClientError,
createHttpClient,
getGlobalHttpClient,
configureGlobalHttpClient
} from './handlers/HttpClient.js';
// Global Error Handler
export {
GlobalErrorHandler,
getGlobalErrorHandler,
configureGlobalErrorHandling,
installGlobalErrorHandling
} from './handlers/GlobalErrorHandler.js';
// UI Components
export {
ToastProvider,
useToast,
useErrorToast,
showErrorToast
} from './ui/ErrorToast.js';
// React Hooks
export {
useHttpClient,
useHttpRequest
} from './hooks/useHttpClient.js';
// Utilities
export {
parseHttpError,
parseFetchError,
parseUnknownError,
isApiError
} from './utils/errorParsers.js';
export {
createUserFriendlyMessage,
humanizeErrorMessage,
createRetryAction,
createRefreshAction,
createSupportAction,
createDismissAction,
formatFieldErrors,
getErrorIcon,
getErrorColor,
truncateErrorMessage,
createToastError,
shouldShowToUser
} from './utils/displayHelpers.js';
// Types
export type {
ApiError,
ErrorContext,
DisplayError,
ErrorAction,
ErrorHandlerConfig,
HttpClientConfig,
HttpErrorResponse,
HttpRequestConfig,
HttpResponse,
GlobalErrorHandlerConfig,
ErrorStats,
ToastConfig,
ToastItem
} from './types/index.js';
export {
ErrorSeverity,
ErrorCategory
} from './types/index.js';