Skip to content

feat(api): extend structured error handling to all error responses#20

Merged
guanbinrui merged 1 commit intomasterfrom
feat/extend-structured-error-handling
Feb 28, 2026
Merged

feat(api): extend structured error handling to all error responses#20
guanbinrui merged 1 commit intomasterfrom
feat/extend-structured-error-handling

Conversation

@swkatmask
Copy link

@swkatmask swkatmask commented Feb 28, 2026

Summary

This PR extends the structured error handling introduced in #19 to cover all remaining API error cases.

Changes

File Error Message error_type HTTP Code
status.nim "Invalid tweet ID" invalid_input 400
search.nim "Search input too long." invalid_input 400
search.nim "Invalid search input" invalid_input 400
search.nim "No results found" no_results 200
search.nim "Invalid search" invalid_input 400
timeline.nim "No results found" no_results 200

Design Decisions

  • invalid_input + Http400: Used for all client input validation errors
  • no_results + Http200: Used for valid searches that return empty results (semantic success)

Test plan

  • Verify error responses include error_type field
  • Verify HTTP status codes are correctly set
  • Test backward compatibility with existing API clients

Add error_type and HTTP status codes to remaining API error cases:
- Invalid input errors (invalid_input, Http400)
- No results errors (no_results, Http200)
- Import HttpCode and Http200 in router_utils for template usage
@swkatmask swkatmask force-pushed the feat/extend-structured-error-handling branch from 9c5efe5 to 060105d Compare February 28, 2026 05:31
@guanbinrui guanbinrui merged commit c8b6205 into master Feb 28, 2026
0 of 3 checks passed
@guanbinrui guanbinrui deleted the feat/extend-structured-error-handling branch February 28, 2026 05:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants