ErrorHandler.php documented as global but only wired into 1 of 33 API endpoints #38

Open
opened 2026-08-31 21:29:45 -04:00 by jared · 0 comments
Owner

Severity: Medium

helpers/ErrorHandler.php is documented in README.md (~line 363) as "Global error/exception handler", but it's only actually invoked from api/get_template.php. The other 32 api/*.php endpoints each hand-roll their own try/catch + ini_set('display_errors', ...) instead, producing inconsistent JSON error shapes across the API surface (ErrorHandler's response shape differs from the ad-hoc {success:false,error:...} pattern used elsewhere).

This reads as an incomplete rollout rather than an intentional design choice.

Fix: Either wire ErrorHandler::init() into all API endpoints for a consistent error contract, or update the README to accurately describe it as used in one specific endpoint rather than "global".

**Severity:** Medium `helpers/ErrorHandler.php` is documented in README.md (~line 363) as "Global error/exception handler", but it's only actually invoked from `api/get_template.php`. The other 32 `api/*.php` endpoints each hand-roll their own try/catch + `ini_set('display_errors', ...)` instead, producing inconsistent JSON error shapes across the API surface (`ErrorHandler`'s response shape differs from the ad-hoc `{success:false,error:...}` pattern used elsewhere). This reads as an incomplete rollout rather than an intentional design choice. **Fix:** Either wire `ErrorHandler::init()` into all API endpoints for a consistent error contract, or update the README to accurately describe it as used in one specific endpoint rather than "global".
jared added the priority/mediumreliability labels 2026-09-08 10:15:44 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: LotusGuild/tinker_tickets#38