Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix(tools): handle all Atlassian error formats in parseJsmErrorMessage
Update parseJsmErrorMessage to extract errors from all Atlassian API
response formats: errorMessage (JSM), errorMessages array (Jira),
errors[].title RFC 7807 (Confluence/Forms), field-level errors object,
and message (gateway). Remove redundant prefix wrapping so the raw
error message surfaces cleanly through the extractor.
  • Loading branch information
waleedlatif1 committed Apr 9, 2026
commit da767587f9189baaaeec59fca339f06ce7e82d03
29 changes: 26 additions & 3 deletions apps/sim/tools/jsm/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,36 @@ 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
}
}
// Jira Platform field-level errors object
if (errorData.errors && !Array.isArray(errorData.errors)) {
const fieldErrors = Object.entries(errorData.errors)
.map(([field, msg]) => `${field}: ${msg}`)
.join(', ')
if (fieldErrors) return fieldErrors
}
// Generic message fallback
Comment thread
waleedlatif1 marked this conversation as resolved.
if (errorData.message) {
return errorData.message
Comment thread
waleedlatif1 marked this conversation as resolved.
}
} catch {
if (errorText) {
return `JSM Forms API error: ${errorText}`
return errorText
}
}
return `JSM Forms API error: ${status} ${statusText}`
return `${status} ${statusText}`
}
Loading