From 8eb1819f41f9b15cf6427d93301e450ad271ce15 Mon Sep 17 00:00:00 2001 From: Waleed Latif Date: Thu, 9 Apr 2026 15:54:28 -0700 Subject: [PATCH] fix(tools): handle all Atlassian error formats in parseJsmErrorMessage The route-level error parser only checked for errorMessage (JSM format), missing errorMessages array (Jira), errors[].title (Forms/Confluence RFC 7807), and message (gateway). Now mirrors the same logic as the atlassian-errors extractor for consistent error extraction at both layers. --- apps/sim/tools/jsm/utils.ts | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/apps/sim/tools/jsm/utils.ts b/apps/sim/tools/jsm/utils.ts index 0081547258..ed333a5a73 100644 --- a/apps/sim/tools/jsm/utils.ts +++ b/apps/sim/tools/jsm/utils.ts @@ -50,13 +50,29 @@ export function parseJsmErrorMessage( ): string { try { const errorData = JSON.parse(errorText) + // JSM Service Desk: singular errorMessage if (errorData.errorMessage) { - return `JSM Forms API error: ${errorData.errorMessage}` + return errorData.errorMessage + } + // Jira Platform: errorMessages array + if (Array.isArray(errorData.errorMessages) && errorData.errorMessages.length > 0) { + return errorData.errorMessages.join(', ') + } + // Confluence v2 / Forms API: RFC 7807 errors array + if (Array.isArray(errorData.errors) && errorData.errors.length > 0) { + const err = errorData.errors[0] + if (err?.title) { + return err.detail ? `${err.title}: ${err.detail}` : err.title + } + } + // Generic message fallback + if (errorData.message) { + return errorData.message } } catch { if (errorText) { - return `JSM Forms API error: ${errorText}` + return errorText } } - return `JSM Forms API error: ${status} ${statusText}` + return `${status} ${statusText}` }