Skip to content

Commit 3d430a4

Browse files
committed
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.
1 parent d458b85 commit 3d430a4

2 files changed

Lines changed: 23 additions & 3 deletions

File tree

apps/sim/tools/error-extractors.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ const ERROR_EXTRACTORS: ErrorExtractorConfig[] = [
7474
if (errorInfo?.data?.message) {
7575
return errorInfo.data.message
7676
}
77+
// Internal proxy route error field fallback
78+
if (typeof errorInfo?.data?.error === 'string') {
79+
return errorInfo.data.error
80+
}
7781
return undefined
7882
},
7983
},

apps/sim/tools/jsm/utils.ts

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,29 @@ export function parseJsmErrorMessage(
5050
): string {
5151
try {
5252
const errorData = JSON.parse(errorText)
53+
// JSM Service Desk: singular errorMessage
5354
if (errorData.errorMessage) {
54-
return `JSM Forms API error: ${errorData.errorMessage}`
55+
return errorData.errorMessage
56+
}
57+
// Jira Platform: errorMessages array
58+
if (Array.isArray(errorData.errorMessages) && errorData.errorMessages.length > 0) {
59+
return errorData.errorMessages.join(', ')
60+
}
61+
// Confluence v2 / Forms API: RFC 7807 errors array
62+
if (Array.isArray(errorData.errors) && errorData.errors.length > 0) {
63+
const err = errorData.errors[0]
64+
if (err?.title) {
65+
return err.detail ? `${err.title}: ${err.detail}` : err.title
66+
}
67+
}
68+
// Generic message fallback
69+
if (errorData.message) {
70+
return errorData.message
5571
}
5672
} catch {
5773
if (errorText) {
58-
return `JSM Forms API error: ${errorText}`
74+
return errorText
5975
}
6076
}
61-
return `JSM Forms API error: ${status} ${statusText}`
77+
return `${status} ${statusText}`
6278
}

0 commit comments

Comments
 (0)