Refactor error handling and logging in API responses
This commit is contained in:
@ -53,5 +53,10 @@ try {
|
||||
];
|
||||
$label = $labels[$action ?? 'import'] ?? 'Operation';
|
||||
error_log("dev fixture $label: " . $e->getMessage());
|
||||
json_error('SERVER_ERROR', "$label failed: " . $e->getMessage(), 500);
|
||||
require_once __DIR__ . '/../lib/errors.php';
|
||||
if (function_exists('qdb_api_log_note_exception')) {
|
||||
qdb_api_log_note_exception($e);
|
||||
}
|
||||
error_log("dev fixture $label: " . $e->getMessage());
|
||||
json_error('SERVER_ERROR', qdb_public_error_message($e, $label), 500);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user