Description
Enhance error handling for page GraphQL queries to provide structured, programmatic error codes and better error context for API consumers.
Current Issues
- Error messages lack structure (no error codes)
- Difficult for clients to handle specific error cases
- Missing HTTP status hints from backend
- Inconsistent error handling between GraphQL errors and data transformations
Solution
Implement structured error handling with:
- Standardized error codes (NOT_FOUND, PERMISSION_DENIED, BAD_REQUEST, INVALID_LANGUAGE)
- HTTP status codes in error responses
- Proper distinction between query failures (bad GraphQL) and missing resources
- Support for partial errors in successful responses
- Enhanced error context (resourceType, resourceId)
Acceptance Criteria
Files Changed
- Backend: PageDataFetcher.java, PermissionDeniedGraphQLException.java
- Frontend: page-api.ts, page-api.spec.ts
- Types: public.ts (DotErrorPage, DotCMSGraphQLError)
Description
Enhance error handling for page GraphQL queries to provide structured, programmatic error codes and better error context for API consumers.
Current Issues
Solution
Implement structured error handling with:
Acceptance Criteria
Files Changed