further enhanced error handling + added retries in case of parallel writes
This commit is contained in:
@ -26,15 +26,7 @@ case 'GET':
|
||||
qdb_discard($tmpDb, $lockFp);
|
||||
json_error('BAD_REQUEST', 'Unknown query', 400);
|
||||
} catch (Throwable $e) {
|
||||
if (isset($tmpDb, $lockFp)) {
|
||||
qdb_discard($tmpDb, $lockFp);
|
||||
}
|
||||
if (function_exists('qdb_api_log_note_exception')) {
|
||||
qdb_api_log_note_exception($e);
|
||||
}
|
||||
require_once __DIR__ . '/../lib/errors.php';
|
||||
error_log('analytics GET: ' . $e->getMessage());
|
||||
json_error('SERVER_ERROR', qdb_public_error_message($e, 'Analytics'), 500);
|
||||
qdb_handler_fail($e, 'Analytics', null, $tmpDb ?? null, $lockFp ?? null);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -50,15 +42,7 @@ case 'PUT':
|
||||
qdb_save($tmpDb, $lockFp);
|
||||
json_success(['clientCode' => $clientCode, 'note' => $note]);
|
||||
} catch (Throwable $e) {
|
||||
if (isset($tmpDb, $lockFp)) {
|
||||
qdb_discard($tmpDb, $lockFp);
|
||||
}
|
||||
if (function_exists('qdb_api_log_note_exception')) {
|
||||
qdb_api_log_note_exception($e);
|
||||
}
|
||||
require_once __DIR__ . '/../lib/errors.php';
|
||||
error_log('analytics PUT: ' . $e->getMessage());
|
||||
json_error('SERVER_ERROR', qdb_public_error_message($e, 'Save note'), 500);
|
||||
qdb_handler_fail($e, 'Save follow-up note', null, $tmpDb ?? null, $lockFp ?? null);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user