From e8470fcce18dffdbbc010a330e505e4f2c14e6e2 Mon Sep 17 00:00:00 2001 From: MananTank Date: Tue, 29 Jul 2025 23:02:35 +0000 Subject: [PATCH] Log SIWA escalation failure error message (#7740) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ## PR-Codex overview This PR focuses on enhancing error handling in the `createSupportTicket` function within the `support.ts` file. It ensures that even if the feedback submission fails, the ticket creation process continues without interruption. ### Detailed summary - Changed the variable `res` to store the result of the `fetch` call to the SIWA URL. - Added an error handling block to log an error message if the `fetch` response is not OK, without failing the ticket creation process. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` ## Summary by CodeRabbit * **Bug Fixes** * Improved error handling for support ticket escalation, ensuring errors are logged if escalation fails without interrupting ticket creation. --- apps/dashboard/src/@/api/support.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/apps/dashboard/src/@/api/support.ts b/apps/dashboard/src/@/api/support.ts index 2badc84828f..dd2d698c735 100644 --- a/apps/dashboard/src/@/api/support.ts +++ b/apps/dashboard/src/@/api/support.ts @@ -61,7 +61,7 @@ export async function createSupportTicket(params: { try { const siwaUrl = process.env.NEXT_PUBLIC_SIWA_URL; if (siwaUrl) { - await fetch(`${siwaUrl}/v1/chat/feedback`, { + const res = await fetch(`${siwaUrl}/v1/chat/feedback`, { method: "POST", headers: { "Content-Type": "application/json", @@ -73,6 +73,12 @@ export async function createSupportTicket(params: { feedbackRating: ESCALATION_FEEDBACK_RATING, }), }); + + if (!res.ok) { + // Log error but don't fail the ticket creation + const errorMessage = await res.text(); + console.error("Failed to escalate to SIWA feedback:", errorMessage); + } } } catch (error) { // Log error but don't fail the ticket creation