Skip to content

Refactor error handling to use Problem Details format across API responses - #6

Merged
ronibhakta1 merged 1 commit into
readium:mainfrom
ronibhakta1:feature/#5/RFC-9457
Jul 1, 2026
Merged

Refactor error handling to use Problem Details format across API responses#6
ronibhakta1 merged 1 commit into
readium:mainfrom
ronibhakta1:feature/#5/RFC-9457

Conversation

@ronibhakta1

Copy link
Copy Markdown
Contributor

Closes #5
This pull request refactors the API error handling to fully adopt the RFC 9457 "problem+json" standard for error responses, improving consistency and machine-readability. It introduces a new ProblemDetail schema, updates all error handlers and OpenAPI docs to use this format, and adjusts tests and endpoints accordingly. Additionally, it adds a Makefile help target and improves documentation for developer workflows.

API error handling improvements:

  • Introduced a new ProblemDetail model and problem_response helper in app/api/errors.py to standardize all error responses as application/problem+json per RFC 9457.
  • Updated all custom exceptions to include a title field and mapped them to appropriate HTTP status codes and error URIs. [1] [2]
  • Refactored all error handlers and endpoints (including /readyz, /synthesize, /voices) to return problem+json responses and updated OpenAPI documentation to reference the new schema. [1] [2] [3] [4] [5] [6] [7]
  • Enhanced validation error responses to include detailed field errors in the errors field.

Test updates:

  • Updated and expanded tests to validate the new error response format, including type, title, status, instance, and errors fields. [1] [2] [3]

Developer workflow improvements:

  • Added a help target to the Makefile as the default goal, and added/updated descriptions for all targets to improve developer experience.

@ronibhakta1
ronibhakta1 merged commit 8b0310a into readium:main Jul 1, 2026
1 check passed
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.

The error code requires support for RFC 9457.

1 participant