Skip to content

feat: standardise api error response#65

Open
xrvnd wants to merge 2 commits into
coder-zs-cse:mainfrom
xrvnd:feat/standardise-api-error-response
Open

feat: standardise api error response#65
xrvnd wants to merge 2 commits into
coder-zs-cse:mainfrom
xrvnd:feat/standardise-api-error-response

Conversation

@xrvnd

@xrvnd xrvnd commented May 27, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add ERROR_CODES constants (1001–1005) and a shared ApiResponse interface so all routes return { data, error?: { code, message } } --> (need more review attention on these error labels please)
  • Update ALL 4 backend routes (/puzzle/status, /puzzle/check, /puzzle/hint, /new-user) to use the standard shape with correct HTTP status codes
  • Update frontend to read actual error messages from the response instead of our hard coded strings - "Database is inactive..."

Test plan

  • Game loads normally when DB is active
  • When DB is inactive, toast shows "Internal server error" (not the old string)
  • Hint and guess flows still work correctly

Closes #36

@vercel

vercel Bot commented May 27, 2026

Copy link
Copy Markdown
Contributor

@xrvnd is attempting to deploy a commit to the coderzs' projects Team on Vercel.

A member of the Team first needs to authorize it.

@coder-zs-cse

Copy link
Copy Markdown
Owner

Pls solve the merge conflicts

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.

feat: standardise API error response model

2 participants