processLogEntries: skip incomplete entries instead of throwing

Per the spec's error-handling table, entries missing timestamp or
details.title should be skipped (logged via consoleLog) and the loop
should continue processing the rest. Previously the function threw
LogEntryIncompleteException and aborted the entire batch, which would
take down the whole UI when a single malformed entry was returned.
This commit is contained in:
Keith Solomon
2026-08-03 14:17:27 -05:00
parent 89ecaaa6c7
commit 73360f6805
+2 -6
View File
@@ -117,9 +117,6 @@ function validateApiResponse($responseData) {
* @param PDOStatement $insertStmt A prepared statement for the idempotent * @param PDOStatement $insertStmt A prepared statement for the idempotent
* insert (`INSERT … ON CONFLICT(id) DO NOTHING`) * insert (`INSERT … ON CONFLICT(id) DO NOTHING`)
* *
* @throws LogEntryIncompleteException If a vault entry is missing timestamp
* or details.title
*
* @return void * @return void
*/ */
function processLogEntries($logEntries, $user, $insertStmt) { function processLogEntries($logEntries, $user, $insertStmt) {
@@ -146,9 +143,8 @@ function processLogEntries($logEntries, $user, $insertStmt) {
} }
if ($timestamp === null || $description === null) { if ($timestamp === null || $description === null) {
throw new LogEntryIncompleteException( consoleLog('Skipping entry ' . $id . ' missing timestamp or details.title: ' . print_r($entry, true));
"Entry $id missing timestamp or details.title." continue;
);
} }
$insertStmt->bindValue(':id', $id); $insertStmt->bindValue(':id', $id);