Update README.md and add debug error handlers

- Completely rewrote README with all new features and admin routes
- Cleaned up remaining migration files
- Added detailed PHP error/exception handlers to dependencies API
  to help debug the 500 error

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-20 17:25:54 -05:00
parent 7462d7c509
commit 08d6808bc3
6 changed files with 145 additions and 281 deletions

View File

@@ -7,10 +7,36 @@
* DELETE: Remove a dependency
*/
// Capture errors for debugging
// Capture ALL errors for debugging
ini_set('display_errors', 0);
error_reporting(E_ALL);
// Custom error handler to return JSON errors
set_error_handler(function($errno, $errstr, $errfile, $errline) {
http_response_code(500);
header('Content-Type: application/json');
echo json_encode([
'success' => false,
'error' => "PHP Error: $errstr",
'file' => basename($errfile),
'line' => $errline
]);
exit;
});
// Custom exception handler
set_exception_handler(function($e) {
http_response_code(500);
header('Content-Type: application/json');
echo json_encode([
'success' => false,
'error' => 'Exception: ' . $e->getMessage(),
'file' => basename($e->getFile()),
'line' => $e->getLine()
]);
exit;
});
// Apply rate limiting (also starts session)
require_once dirname(__DIR__) . '/middleware/RateLimitMiddleware.php';
RateLimitMiddleware::apply('api');