Repository navigation
Expand file tree
/
Copy pathtypes.ts
More file actions
64 lines (55 loc) · 1.77 KB
/
Copy pathtypes.ts
File metadata and controls
64 lines (55 loc) · 1.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// Centralized error types for all modules
export enum ErrorCode {
// Validation Errors (400-499)
INVALID_FILE_FORMAT = "INVALID_FILE_FORMAT",
MISSING_REQUIRED_FIELD = "MISSING_REQUIRED_FIELD",
INVALID_CONFIGURATION = "INVALID_CONFIGURATION",
UNSUPPORTED_OPERATION = "UNSUPPORTED_OPERATION",
// Authentication/Authorization (401-403)
INVALID_API_KEY = "INVALID_API_KEY",
INSUFFICIENT_PERMISSIONS = "INSUFFICIENT_PERMISSIONS",
// Resource Errors (404-409)
RESOURCE_NOT_FOUND = "RESOURCE_NOT_FOUND",
STYLE_NOT_FOUND = "STYLE_NOT_FOUND",
MODEL_NOT_FOUND = "MODEL_NOT_FOUND",
// Rate Limiting (429)
RATE_LIMIT_EXCEEDED = "RATE_LIMIT_EXCEEDED",
// External Service Errors (500-503)
AI_SERVICE_ERROR = "AI_SERVICE_ERROR",
NETWORK_TIMEOUT = "NETWORK_TIMEOUT",
SERVICE_UNAVAILABLE = "SERVICE_UNAVAILABLE",
// Processing Errors (500)
PROCESSING_FAILED = "PROCESSING_FAILED",
GENERATION_FAILED = "GENERATION_FAILED",
PARSING_FAILED = "PARSING_FAILED",
VALIDATION_FAILED = "VALIDATION_FAILED",
// System Errors (500)
INTERNAL_ERROR = "INTERNAL_ERROR",
CONFIGURATION_ERROR = "CONFIGURATION_ERROR",
DEPENDENCY_ERROR = "DEPENDENCY_ERROR",
}
export interface ErrorContext {
operation: string;
module: "extractor" | "generator" | "fraud-detector";
timestamp: string;
requestId?: string;
userId?: string;
metadata?: Record<string, any>;
}
export interface RecoveryStrategy {
type: "retry" | "fallback" | "manual" | "ignore";
description: string;
autoRetry?: boolean;
maxRetries?: number;
fallbackAction?: string;
}
export interface ErrorDetails {
code: ErrorCode;
message: string;
statusCode: number;
context: ErrorContext;
recovery: RecoveryStrategy;
userMessage: string;
technicalDetails?: string;
relatedErrors?: ErrorCode[];
}