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

Closed
opened 2026-08-31 21:29:45 -04:00 by jared · 1 comment
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
Author
Owner

Fixed and verified against real MariaDB and real running endpoints (uncaught-fatal handling, privilege re-sync flow). Merged to main in commit 5a69c41.

Fixed and verified against real MariaDB and real running endpoints (uncaught-fatal handling, privilege re-sync flow). Merged to main in commit 5a69c41.
jared closed this issue 2026-09-11 12:23:59 -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