refactor: standardise error response format across API controllers #20

Open
opened 2026-02-20 16:38:32 +00:00 by Clotho · 0 comments
Member

Problem

Error response formats vary between Controllers/EntitlementApiController.php and Controllers/Api/EntitlementWebhookController.php. Some return {"error": "msg"}, others {"success": false, "message": "msg"}.

Standard to adopt

{
  "success": false,
  "error": "Human-readable message",
  "code": "MACHINE_READABLE_CODE"
}

Acceptance Criteria

  • Create an ApiResponseTrait or use existing HasApiResponses consistently
  • Apply uniform error format to all API controllers in this package
  • Document response format in README.md or docs/
  • Update integration tests to assert the standardised format

Discovered during automated scan (issue #3)

## Problem Error response formats vary between `Controllers/EntitlementApiController.php` and `Controllers/Api/EntitlementWebhookController.php`. Some return `{"error": "msg"}`, others `{"success": false, "message": "msg"}`. ## Standard to adopt ```json { "success": false, "error": "Human-readable message", "code": "MACHINE_READABLE_CODE" } ``` ## Acceptance Criteria - Create an `ApiResponseTrait` or use existing `HasApiResponses` consistently - Apply uniform error format to all API controllers in this package - Document response format in `README.md` or `docs/` - Update integration tests to assert the standardised format _Discovered during automated scan (issue #3)_
Clotho added the
discovery
refactor
P3
labels 2026-02-20 16:38:32 +00:00
Clotho was assigned by Charon 2026-02-20 23:46:42 +00:00
Charon added the
agent-ready
label 2026-02-21 01:31:56 +00:00
Sign in to join this conversation.
No description provided.