From 6743f8cee8063738f8fcc33fc290fa748fe2c22c Mon Sep 17 00:00:00 2001
From: hnouts <hnouts@grandlyon.com>
Date: Mon, 19 Jun 2023 10:24:48 +0200
Subject: [PATCH] captureMessage instead of exception to reduce duplicated
 error

---
 src/index.js | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/index.js b/src/index.js
index 2b1b630..1cddbc5 100644
--- a/src/index.js
+++ b/src/index.js
@@ -109,7 +109,14 @@ async function start(fields, cozyParameters) {
     transaction.setStatus(Tracing.SpanStatus.Ok)
     transaction.finish()
   } catch (error) {
-    Sentry.captureException(error)
+    const errorMessage = `EGL konnector encountered an error. Response data: ${JSON.stringify(
+      error.message
+    )}`
+    Sentry.captureMessage(errorMessage, {
+      tags: {
+        section: 'start',
+      },
+    })
     transaction.setStatus(Tracing.SpanStatus.Aborted)
     transaction.finish()
     await Sentry.flush()
-- 
GitLab