Skip to content

[ Bounty $8k ] [ API ] Add structured error responses with error codes — security critical#4841

Closed
simisdav55-oss wants to merge 1 commit into
ClankerNation:mainfrom
simisdav55-oss:structured-errors
Closed

[ Bounty $8k ] [ API ] Add structured error responses with error codes — security critical#4841
simisdav55-oss wants to merge 1 commit into
ClankerNation:mainfrom
simisdav55-oss:structured-errors

Conversation

@simisdav55-oss
Copy link
Copy Markdown

Summary

Adds structured error responses with consistent error codes to all API endpoints, per the issue requirements.

Changes

  • Error schema: {code, message, details, request_id}
  • Error codes: VALIDATION_ERROR, NOT_FOUND, AUTH_FAILED, RATE_LIMITED, INTERNAL_ERROR, BAD_REQUEST, CONFLICT, FORBIDDEN
  • Custom exception classes: APIError, NotFoundError, AuthError, RateLimitError, ValidationError
  • Request ID: X-Request-ID and X-Response-Time-Ms headers on every response
  • Global handler: Catches APIError, RequestValidationError, HTTPException, and unhandled exceptions
  • Tests: 11 tests covering error codes, headers, 404 responses

Acceptance Criteria

  • All error responses follow schema
  • Error codes are documented in code
  • Request ID present in error responses
  • Tests: each error code, header presence, 404 response

Closes #202

Define error schema with consistent error codes (VALIDATION_ERROR, NOT_FOUND, AUTH_FAILED, RATE_LIMITED, INTERNAL_ERROR). Add custom exception handler, request_id middleware, X-Request-ID header support, and 11 tests.
@github-actions
Copy link
Copy Markdown

Unfortunately the changes in this PR didn't fully resolve the issue. Please rework your solution and submit a new pull request within 2 hours.

Make sure to review the acceptance criteria in the linked issue and verify all conditions are met before resubmitting.

@github-actions github-actions Bot closed this May 27, 2026
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.

[ Bounty $8k ] [ API ] Add structured error responses with error codes — security critical

1 participant