-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmsg.ts
More file actions
32 lines (32 loc) · 1.21 KB
/
msg.ts
File metadata and controls
32 lines (32 loc) · 1.21 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
type msg = {
"status": "success" | "error" | "partial", // More descriptive than boolean
"message": string, // High-level response message
"data": any | null, // Response payload when successful
"errors": { // Only present when status is "error" or "partial"
"validation": [ // Categorized errors
{
"field": string,
"code": string, // Specific error code for this field
"message": string,
"context": { // Rich context for debugging/display
"value": any,
"constraint": string,
// Additional context specific to error type
}
}
],
"business": [...], // Business logic errors
"server": [...] // Server errors if exposed
},
"meta": {
"timestamp": string,
"requestId": string,
"statusCode": number, // HTTP status code mirror
"pagination": { // When applicable
"page": number,
"pageSize": number,
"totalItems": number,
"totalPages": number
}
}
}