From 10a3292fd9d7005227f4d122f29827b7db611edd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daphn=C3=A9=20Popin?= Date: Wed, 22 Nov 2023 11:11:15 +0100 Subject: [PATCH] Gdrive Connector: log tags when failing to upsert document --- .../google_drive/temporal/activities.ts | 29 +++++++++++-------- 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/connectors/src/connectors/google_drive/temporal/activities.ts b/connectors/src/connectors/google_drive/temporal/activities.ts index 9085f717d013..3e7754b13e8b 100644 --- a/connectors/src/connectors/google_drive/temporal/activities.ts +++ b/connectors/src/connectors/google_drive/temporal/activities.ts @@ -482,18 +482,23 @@ async function syncOneFile( parents.push(file.id); parents.reverse(); - await upsertToDatasource({ - dataSourceConfig, - documentId, - documentText: documentContent, - documentUrl: file.webViewLink, - timestampMs: file.updatedAtMs, - tags, - parents: parents, - upsertContext: { - sync_type: isBatchSync ? "batch" : "incremental", - }, - }); + try { + await upsertToDatasource({ + dataSourceConfig, + documentId, + documentText: documentContent, + documentUrl: file.webViewLink, + timestampMs: file.updatedAtMs, + tags, + parents: parents, + upsertContext: { + sync_type: isBatchSync ? "batch" : "incremental", + }, + }); + } catch (e) { + logger.error({ error: e, tags }, "Failed to upsert document"); + throw e; + } upsertTimestampMs = file.updatedAtMs; } else { logger.info(