ai-spector 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +169 -0
- package/_templates/basic_design/db-design-template.md +177 -0
- package/_templates/basic_design/detail-api-template.md +278 -0
- package/_templates/basic_design/detail-screen-template.md +281 -0
- package/_templates/basic_design/list-api-template.md +130 -0
- package/_templates/basic_design/list-screen-template.md +242 -0
- package/_templates/detail_design/common/architecture-overview-template.md +302 -0
- package/_templates/detail_design/common/deployment-infrastructure-template.md +461 -0
- package/_templates/detail_design/common/error-handling-patterns-template.md +460 -0
- package/_templates/detail_design/common/integration-patterns-template.md +410 -0
- package/_templates/detail_design/common/performance-standards-template.md +406 -0
- package/_templates/detail_design/common/security-patterns-template.md +395 -0
- package/_templates/detail_design/feature-detail-design-template.md +773 -0
- package/_templates/detail_design/feature-list-template.md +39 -0
- package/_templates/srs/1-introduction.md +58 -0
- package/_templates/srs/2-overall-description.md +91 -0
- package/_templates/srs/3-use-case-detail-template.md +142 -0
- package/_templates/srs/3-use-cases.md +53 -0
- package/_templates/srs/4-system-feature-detail-template.md +131 -0
- package/_templates/srs/4-system-features-list-template.md +39 -0
- package/_templates/srs/5-data-requirements.md +59 -0
- package/_templates/srs/6-external-interfaces.md +56 -0
- package/_templates/srs/7-quality-attributes.md +74 -0
- package/_templates/srs/8-internationalization.md +36 -0
- package/_templates/srs/9-other-requirements.md +46 -0
- package/assets/cursor/commands/analyze.md +39 -0
- package/assets/cursor/commands/generate-detail-design.md +35 -0
- package/assets/cursor/commands/generate-srs.md +38 -0
- package/assets/cursor/skills/spec-writer/SKILL.md +33 -0
- package/assets/workflow/config/analyze.graphify.json +36 -0
- package/assets/workflow/config/completeness-rules.detail-design.json +57 -0
- package/assets/workflow/config/completeness-rules.srs.json +72 -0
- package/assets/workflow/config/dag.detail-design.json +64 -0
- package/assets/workflow/config/dag.srs.json +87 -0
- package/assets/workflow/state/state.template.json +26 -0
- package/assets/workflow/templates/basic_design/db-design-template.md +177 -0
- package/assets/workflow/templates/basic_design/detail-api-template.md +278 -0
- package/assets/workflow/templates/basic_design/detail-screen-template.md +281 -0
- package/assets/workflow/templates/basic_design/list-api-template.md +130 -0
- package/assets/workflow/templates/basic_design/list-screen-template.md +242 -0
- package/assets/workflow/templates/detail_design/common/architecture-overview-template.md +302 -0
- package/assets/workflow/templates/detail_design/common/deployment-infrastructure-template.md +461 -0
- package/assets/workflow/templates/detail_design/common/error-handling-patterns-template.md +460 -0
- package/assets/workflow/templates/detail_design/common/integration-patterns-template.md +410 -0
- package/assets/workflow/templates/detail_design/common/performance-standards-template.md +406 -0
- package/assets/workflow/templates/detail_design/common/security-patterns-template.md +395 -0
- package/assets/workflow/templates/detail_design/feature-detail-design-template.md +773 -0
- package/assets/workflow/templates/detail_design/feature-list-template.md +39 -0
- package/assets/workflow/templates/srs/1-introduction.md +58 -0
- package/assets/workflow/templates/srs/2-overall-description.md +91 -0
- package/assets/workflow/templates/srs/3-use-case-detail-template.md +142 -0
- package/assets/workflow/templates/srs/3-use-cases.md +53 -0
- package/assets/workflow/templates/srs/4-system-feature-detail-template.md +131 -0
- package/assets/workflow/templates/srs/4-system-features-list-template.md +39 -0
- package/assets/workflow/templates/srs/5-data-requirements.md +59 -0
- package/assets/workflow/templates/srs/6-external-interfaces.md +56 -0
- package/assets/workflow/templates/srs/7-quality-attributes.md +74 -0
- package/assets/workflow/templates/srs/8-internationalization.md +36 -0
- package/assets/workflow/templates/srs/9-other-requirements.md +46 -0
- package/bin/spec-writer.js +56 -0
- package/package.json +25 -0
- package/src/cli/helpers/fs.js +50 -0
- package/src/cli/init.js +178 -0
|
@@ -0,0 +1,460 @@
|
|
|
1
|
+
# Error Handling Patterns: <Project Name>
|
|
2
|
+
|
|
3
|
+
> This document defines standard error handling patterns, error codes, exception handling strategies, and user-facing error messages used across all features.
|
|
4
|
+
|
|
5
|
+
**Source Requirements:** SRS Section 7 (Quality Attributes - Reliability)
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 1. Overview
|
|
10
|
+
|
|
11
|
+
**Purpose:**
|
|
12
|
+
> This document establishes error handling standards that ensure consistent error responses, proper logging, and good user experience across all features.
|
|
13
|
+
|
|
14
|
+
**Error Handling Principles:**
|
|
15
|
+
- Fail fast and fail clearly
|
|
16
|
+
- Provide meaningful error messages
|
|
17
|
+
- Log errors for debugging
|
|
18
|
+
- Don't expose sensitive information
|
|
19
|
+
- Handle errors gracefully
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## 2. Standard Error Response Format
|
|
24
|
+
|
|
25
|
+
### 2.1 API Error Response
|
|
26
|
+
|
|
27
|
+
**Standard Format:**
|
|
28
|
+
```json
|
|
29
|
+
{
|
|
30
|
+
"error": {
|
|
31
|
+
"code": "ERROR_CODE",
|
|
32
|
+
"message": "Human-readable error message",
|
|
33
|
+
"details": {
|
|
34
|
+
"field": "Additional error details",
|
|
35
|
+
"timestamp": "2025-01-15T10:30:00Z",
|
|
36
|
+
"request_id": "req_123456789"
|
|
37
|
+
},
|
|
38
|
+
"errors": [
|
|
39
|
+
{
|
|
40
|
+
"field": "email",
|
|
41
|
+
"message": "Invalid email format"
|
|
42
|
+
}
|
|
43
|
+
]
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
**HTTP Status Codes:**
|
|
49
|
+
- `400 Bad Request`: Client error (validation, malformed request)
|
|
50
|
+
- `401 Unauthorized`: Authentication required
|
|
51
|
+
- `403 Forbidden`: Insufficient permissions
|
|
52
|
+
- `404 Not Found`: Resource not found
|
|
53
|
+
- `409 Conflict`: Resource conflict (duplicate, constraint violation)
|
|
54
|
+
- `422 Unprocessable Entity`: Validation errors
|
|
55
|
+
- `429 Too Many Requests`: Rate limit exceeded
|
|
56
|
+
- `500 Internal Server Error`: Server error
|
|
57
|
+
- `503 Service Unavailable`: Service temporarily unavailable
|
|
58
|
+
|
|
59
|
+
### 2.2 Error Response Fields
|
|
60
|
+
|
|
61
|
+
| Field | Type | Required | Description |
|
|
62
|
+
|-------|------|----------|-------------|
|
|
63
|
+
| `error.code` | string | Yes | Machine-readable error code |
|
|
64
|
+
| `error.message` | string | Yes | Human-readable error message |
|
|
65
|
+
| `error.details` | object | No | Additional error context |
|
|
66
|
+
| `error.errors` | array | No | Field-specific validation errors |
|
|
67
|
+
| `error.timestamp` | string | Yes | ISO 8601 timestamp |
|
|
68
|
+
| `error.request_id` | string | Yes | Unique request identifier for tracing |
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## 3. Error Code Taxonomy
|
|
73
|
+
|
|
74
|
+
### 3.1 Error Code Format
|
|
75
|
+
|
|
76
|
+
**Format:** `<CATEGORY>_<SUBCATEGORY>_<SPECIFIC>`
|
|
77
|
+
|
|
78
|
+
**Categories:**
|
|
79
|
+
- `VALIDATION`: Input validation errors
|
|
80
|
+
- `AUTHENTICATION`: Authentication failures
|
|
81
|
+
- `AUTHORIZATION`: Authorization failures
|
|
82
|
+
- `NOT_FOUND`: Resource not found
|
|
83
|
+
- `CONFLICT`: Resource conflicts
|
|
84
|
+
- `EXTERNAL`: External service errors
|
|
85
|
+
- `INTERNAL`: Internal server errors
|
|
86
|
+
- `RATE_LIMIT`: Rate limiting errors
|
|
87
|
+
|
|
88
|
+
### 3.2 Common Error Codes
|
|
89
|
+
|
|
90
|
+
**Validation Errors:**
|
|
91
|
+
- `VALIDATION_REQUIRED`: Required field missing
|
|
92
|
+
- `VALIDATION_INVALID_FORMAT`: Invalid format
|
|
93
|
+
- `VALIDATION_OUT_OF_RANGE`: Value out of allowed range
|
|
94
|
+
- `VALIDATION_DUPLICATE`: Duplicate value not allowed
|
|
95
|
+
|
|
96
|
+
**Authentication Errors:**
|
|
97
|
+
- `AUTH_INVALID_CREDENTIALS`: Invalid username/password
|
|
98
|
+
- `AUTH_TOKEN_EXPIRED`: Authentication token expired
|
|
99
|
+
- `AUTH_TOKEN_INVALID`: Invalid authentication token
|
|
100
|
+
- `AUTH_REQUIRED`: Authentication required
|
|
101
|
+
|
|
102
|
+
**Authorization Errors:**
|
|
103
|
+
- `AUTHZ_INSUFFICIENT_PERMISSIONS`: User lacks required permissions
|
|
104
|
+
- `AUTHZ_RESOURCE_FORBIDDEN`: Access to resource forbidden
|
|
105
|
+
- `AUTHZ_ROLE_REQUIRED`: Specific role required
|
|
106
|
+
|
|
107
|
+
**Not Found Errors:**
|
|
108
|
+
- `NOT_FOUND_RESOURCE`: Resource not found
|
|
109
|
+
- `NOT_FOUND_ENDPOINT`: API endpoint not found
|
|
110
|
+
|
|
111
|
+
**Conflict Errors:**
|
|
112
|
+
- `CONFLICT_DUPLICATE`: Duplicate resource
|
|
113
|
+
- `CONFLICT_STATE`: Invalid state for operation
|
|
114
|
+
- `CONFLICT_CONCURRENT_MODIFICATION`: Concurrent modification detected
|
|
115
|
+
|
|
116
|
+
**External Service Errors:**
|
|
117
|
+
- `EXTERNAL_SERVICE_UNAVAILABLE`: External service unavailable
|
|
118
|
+
- `EXTERNAL_SERVICE_TIMEOUT`: External service timeout
|
|
119
|
+
- `EXTERNAL_SERVICE_ERROR`: External service error
|
|
120
|
+
|
|
121
|
+
**Internal Errors:**
|
|
122
|
+
- `INTERNAL_SERVER_ERROR`: Internal server error
|
|
123
|
+
- `INTERNAL_DATABASE_ERROR`: Database error
|
|
124
|
+
- `INTERNAL_PROCESSING_ERROR`: Processing error
|
|
125
|
+
|
|
126
|
+
**Rate Limit Errors:**
|
|
127
|
+
- `RATE_LIMIT_EXCEEDED`: Rate limit exceeded
|
|
128
|
+
- `RATE_LIMIT_QUOTA_EXCEEDED`: Quota exceeded
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## 4. Exception Handling Strategy
|
|
133
|
+
|
|
134
|
+
### 4.1 Exception Hierarchy
|
|
135
|
+
|
|
136
|
+
**Exception Types:**
|
|
137
|
+
```
|
|
138
|
+
BaseException
|
|
139
|
+
├── ValidationException
|
|
140
|
+
│ ├── RequiredFieldException
|
|
141
|
+
│ ├── InvalidFormatException
|
|
142
|
+
│ └── OutOfRangeException
|
|
143
|
+
├── AuthenticationException
|
|
144
|
+
│ ├── InvalidCredentialsException
|
|
145
|
+
│ └── TokenExpiredException
|
|
146
|
+
├── AuthorizationException
|
|
147
|
+
│ └── InsufficientPermissionsException
|
|
148
|
+
├── NotFoundException
|
|
149
|
+
├── ConflictException
|
|
150
|
+
│ └── DuplicateResourceException
|
|
151
|
+
├── ExternalServiceException
|
|
152
|
+
│ ├── ServiceUnavailableException
|
|
153
|
+
│ └── ServiceTimeoutException
|
|
154
|
+
└── InternalException
|
|
155
|
+
├── DatabaseException
|
|
156
|
+
└── ProcessingException
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### 4.2 Exception Handling Flow
|
|
160
|
+
|
|
161
|
+
```mermaid
|
|
162
|
+
flowchart TD
|
|
163
|
+
Request[API Request] --> Validation{Input Validation}
|
|
164
|
+
Validation -->|Valid| BusinessLogic[Business Logic]
|
|
165
|
+
Validation -->|Invalid| ValidationError[ValidationException]
|
|
166
|
+
BusinessLogic -->|Success| Response[Success Response]
|
|
167
|
+
BusinessLogic -->|Error| ExceptionHandler[Exception Handler]
|
|
168
|
+
ExceptionHandler -->|Known Exception| MapError[Map to Error Code]
|
|
169
|
+
ExceptionHandler -->|Unknown Exception| LogError[Log Error]
|
|
170
|
+
MapError --> ErrorResponse[Error Response]
|
|
171
|
+
LogError --> GenericError[Generic Error Response]
|
|
172
|
+
ErrorResponse --> Client[Client]
|
|
173
|
+
GenericError --> Client
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### 4.3 Exception Handling Best Practices
|
|
177
|
+
|
|
178
|
+
**Do:**
|
|
179
|
+
- Catch specific exceptions
|
|
180
|
+
- Log errors with context
|
|
181
|
+
- Return appropriate HTTP status codes
|
|
182
|
+
- Provide meaningful error messages
|
|
183
|
+
- Include request ID for tracing
|
|
184
|
+
|
|
185
|
+
**Don't:**
|
|
186
|
+
- Expose internal implementation details
|
|
187
|
+
- Return stack traces to clients
|
|
188
|
+
- Log sensitive information
|
|
189
|
+
- Swallow exceptions silently
|
|
190
|
+
- Return generic "Something went wrong" messages
|
|
191
|
+
|
|
192
|
+
---
|
|
193
|
+
|
|
194
|
+
## 5. User-Facing Error Messages
|
|
195
|
+
|
|
196
|
+
### 5.1 Message Guidelines
|
|
197
|
+
|
|
198
|
+
**Principles:**
|
|
199
|
+
- Clear and concise
|
|
200
|
+
- Actionable when possible
|
|
201
|
+
- User-friendly language
|
|
202
|
+
- Avoid technical jargon
|
|
203
|
+
- Don't blame the user
|
|
204
|
+
|
|
205
|
+
### 5.2 Message Examples
|
|
206
|
+
|
|
207
|
+
**Good Messages:**
|
|
208
|
+
- "Please enter a valid email address"
|
|
209
|
+
- "Password must be at least 8 characters long"
|
|
210
|
+
- "This email is already registered. Please sign in or use a different email"
|
|
211
|
+
- "We couldn't find the page you're looking for"
|
|
212
|
+
|
|
213
|
+
**Bad Messages:**
|
|
214
|
+
- "Error 500"
|
|
215
|
+
- "Invalid input"
|
|
216
|
+
- "Database connection failed"
|
|
217
|
+
- "Null pointer exception"
|
|
218
|
+
|
|
219
|
+
### 5.3 Localization
|
|
220
|
+
|
|
221
|
+
**Error Message Localization:**
|
|
222
|
+
- Store error messages in resource files
|
|
223
|
+
- Support multiple languages
|
|
224
|
+
- Use message keys for consistency
|
|
225
|
+
- Provide default fallback messages
|
|
226
|
+
|
|
227
|
+
---
|
|
228
|
+
|
|
229
|
+
## 6. Logging and Monitoring
|
|
230
|
+
|
|
231
|
+
### 6.1 Error Logging
|
|
232
|
+
|
|
233
|
+
**Log Levels:**
|
|
234
|
+
- **ERROR**: Errors that require attention but don't stop the system
|
|
235
|
+
- **CRITICAL**: Critical errors that may stop the system
|
|
236
|
+
- **WARNING**: Warnings that may indicate problems
|
|
237
|
+
|
|
238
|
+
**Log Format:**
|
|
239
|
+
```json
|
|
240
|
+
{
|
|
241
|
+
"timestamp": "2025-01-15T10:30:00Z",
|
|
242
|
+
"level": "ERROR",
|
|
243
|
+
"error_code": "VALIDATION_INVALID_FORMAT",
|
|
244
|
+
"message": "Invalid email format",
|
|
245
|
+
"request_id": "req_123456789",
|
|
246
|
+
"user_id": "user123",
|
|
247
|
+
"ip_address": "192.168.1.1",
|
|
248
|
+
"stack_trace": "...",
|
|
249
|
+
"context": {
|
|
250
|
+
"field": "email",
|
|
251
|
+
"value": "invalid-email"
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
### 6.2 Error Monitoring
|
|
257
|
+
|
|
258
|
+
**Monitoring Metrics:**
|
|
259
|
+
- Error rate by error code
|
|
260
|
+
- Error rate by endpoint
|
|
261
|
+
- Error rate over time
|
|
262
|
+
- Response time for error cases
|
|
263
|
+
|
|
264
|
+
**Alerting:**
|
|
265
|
+
- Critical error threshold exceeded
|
|
266
|
+
- Unusual error pattern detected
|
|
267
|
+
- Error rate spike detected
|
|
268
|
+
|
|
269
|
+
---
|
|
270
|
+
|
|
271
|
+
## 7. Retry and Recovery Patterns
|
|
272
|
+
|
|
273
|
+
### 7.1 Retry Strategy
|
|
274
|
+
|
|
275
|
+
**When to Retry:**
|
|
276
|
+
- Transient errors (network timeouts, temporary service unavailability)
|
|
277
|
+
- Rate limit errors (with backoff)
|
|
278
|
+
- External service errors
|
|
279
|
+
|
|
280
|
+
**When NOT to Retry:**
|
|
281
|
+
- Client errors (4xx)
|
|
282
|
+
- Authentication/authorization errors
|
|
283
|
+
- Validation errors
|
|
284
|
+
- Permanent failures
|
|
285
|
+
|
|
286
|
+
### 7.2 Retry Configuration
|
|
287
|
+
|
|
288
|
+
**Retry Parameters:**
|
|
289
|
+
- Max Retries: <Number, e.g., 3>
|
|
290
|
+
- Initial Delay: <Duration, e.g., 100ms>
|
|
291
|
+
- Backoff Strategy: <Exponential/Linear>
|
|
292
|
+
- Max Delay: <Duration, e.g., 5s>
|
|
293
|
+
|
|
294
|
+
**Exponential Backoff Example:**
|
|
295
|
+
```
|
|
296
|
+
Attempt 1: Wait 100ms
|
|
297
|
+
Attempt 2: Wait 200ms
|
|
298
|
+
Attempt 3: Wait 400ms
|
|
299
|
+
Attempt 4: Wait 800ms
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
### 7.3 Circuit Breaker Pattern
|
|
303
|
+
|
|
304
|
+
**Circuit Breaker States:**
|
|
305
|
+
- **Closed**: Normal operation
|
|
306
|
+
- **Open**: Failing, reject requests immediately
|
|
307
|
+
- **Half-Open**: Testing if service recovered
|
|
308
|
+
|
|
309
|
+
**Configuration:**
|
|
310
|
+
- Failure Threshold: <Number of failures to open circuit>
|
|
311
|
+
- Timeout: <Duration before attempting recovery>
|
|
312
|
+
- Success Threshold: <Number of successes to close circuit>
|
|
313
|
+
|
|
314
|
+
---
|
|
315
|
+
|
|
316
|
+
## 8. Error Handling by Layer
|
|
317
|
+
|
|
318
|
+
### 8.1 Client-Side Error Handling
|
|
319
|
+
|
|
320
|
+
**Responsibilities:**
|
|
321
|
+
- Display user-friendly error messages
|
|
322
|
+
- Handle network errors
|
|
323
|
+
- Retry failed requests when appropriate
|
|
324
|
+
- Show loading states
|
|
325
|
+
- Handle validation errors
|
|
326
|
+
|
|
327
|
+
### 8.2 API Gateway Error Handling
|
|
328
|
+
|
|
329
|
+
**Responsibilities:**
|
|
330
|
+
- Validate request format
|
|
331
|
+
- Handle authentication errors
|
|
332
|
+
- Rate limiting
|
|
333
|
+
- Request/response transformation
|
|
334
|
+
- Error response formatting
|
|
335
|
+
|
|
336
|
+
### 8.3 Application Layer Error Handling
|
|
337
|
+
|
|
338
|
+
**Responsibilities:**
|
|
339
|
+
- Business logic validation
|
|
340
|
+
- Exception catching and mapping
|
|
341
|
+
- Error logging
|
|
342
|
+
- Error response generation
|
|
343
|
+
|
|
344
|
+
### 8.4 Database Layer Error Handling
|
|
345
|
+
|
|
346
|
+
**Responsibilities:**
|
|
347
|
+
- Handle database connection errors
|
|
348
|
+
- Handle constraint violations
|
|
349
|
+
- Handle transaction errors
|
|
350
|
+
- Map database errors to application errors
|
|
351
|
+
|
|
352
|
+
---
|
|
353
|
+
|
|
354
|
+
## 9. Error Handling Examples
|
|
355
|
+
|
|
356
|
+
### 9.1 Validation Error Example
|
|
357
|
+
|
|
358
|
+
**Request:**
|
|
359
|
+
```http
|
|
360
|
+
POST /api/users
|
|
361
|
+
Content-Type: application/json
|
|
362
|
+
|
|
363
|
+
{
|
|
364
|
+
"email": "invalid-email",
|
|
365
|
+
"age": -5
|
|
366
|
+
}
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
**Response:**
|
|
370
|
+
```http
|
|
371
|
+
HTTP/1.1 422 Unprocessable Entity
|
|
372
|
+
Content-Type: application/json
|
|
373
|
+
|
|
374
|
+
{
|
|
375
|
+
"error": {
|
|
376
|
+
"code": "VALIDATION_ERROR",
|
|
377
|
+
"message": "Validation failed",
|
|
378
|
+
"timestamp": "2025-01-15T10:30:00Z",
|
|
379
|
+
"request_id": "req_123456789",
|
|
380
|
+
"errors": [
|
|
381
|
+
{
|
|
382
|
+
"field": "email",
|
|
383
|
+
"message": "Invalid email format"
|
|
384
|
+
},
|
|
385
|
+
{
|
|
386
|
+
"field": "age",
|
|
387
|
+
"message": "Age must be a positive number"
|
|
388
|
+
}
|
|
389
|
+
]
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
### 9.2 Authentication Error Example
|
|
395
|
+
|
|
396
|
+
**Request:**
|
|
397
|
+
```http
|
|
398
|
+
GET /api/users/me
|
|
399
|
+
Authorization: Bearer invalid_token
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
**Response:**
|
|
403
|
+
```http
|
|
404
|
+
HTTP/1.1 401 Unauthorized
|
|
405
|
+
Content-Type: application/json
|
|
406
|
+
|
|
407
|
+
{
|
|
408
|
+
"error": {
|
|
409
|
+
"code": "AUTH_TOKEN_INVALID",
|
|
410
|
+
"message": "Invalid authentication token",
|
|
411
|
+
"timestamp": "2025-01-15T10:30:00Z",
|
|
412
|
+
"request_id": "req_123456789"
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
### 9.3 Not Found Error Example
|
|
418
|
+
|
|
419
|
+
**Request:**
|
|
420
|
+
```http
|
|
421
|
+
GET /api/users/999
|
|
422
|
+
```
|
|
423
|
+
|
|
424
|
+
**Response:**
|
|
425
|
+
```http
|
|
426
|
+
HTTP/1.1 404 Not Found
|
|
427
|
+
Content-Type: application/json
|
|
428
|
+
|
|
429
|
+
{
|
|
430
|
+
"error": {
|
|
431
|
+
"code": "NOT_FOUND_RESOURCE",
|
|
432
|
+
"message": "User not found",
|
|
433
|
+
"timestamp": "2025-01-15T10:30:00Z",
|
|
434
|
+
"request_id": "req_123456789"
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
```
|
|
438
|
+
|
|
439
|
+
---
|
|
440
|
+
|
|
441
|
+
## 10. References
|
|
442
|
+
|
|
443
|
+
**Related Documents:**
|
|
444
|
+
- [Security Patterns](../common/security-patterns-template.md)
|
|
445
|
+
- [Feature Detail Design Template](../feature-detail-design-template.md)
|
|
446
|
+
|
|
447
|
+
**SRS References:**
|
|
448
|
+
- SRS Section 7: Quality Attributes - Reliability
|
|
449
|
+
|
|
450
|
+
---
|
|
451
|
+
|
|
452
|
+
## 11. Notes
|
|
453
|
+
|
|
454
|
+
**Error Handling Considerations:**
|
|
455
|
+
- <Consideration 1>
|
|
456
|
+
- <Consideration 2>
|
|
457
|
+
|
|
458
|
+
**Future Enhancements:**
|
|
459
|
+
- <Enhancement 1>
|
|
460
|
+
- <Enhancement 2>
|