Skip to content
Merged
Changes from 1 commit
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
Next Next commit
fix(tools): handle all Atlassian error formats in parseJsmErrorMessage (
#4088)

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 authored Apr 10, 2026
commit 171485d3b6740a4b9bcfb6bddb3bda21142c6c94
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
if (errorData.message) {
Comment on lines +53 to +76
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Non-TSDoc inline comments violate project standards

The added // comments (// JSM Service Desk: singular errorMessage, // Jira Platform: errorMessages array, etc.) are non-TSDoc comments. The project's global standards explicitly forbid non-TSDoc comments — all documentation should use TSDoc format or be removed.

Context Used: Global coding standards that apply to all files (source)

return errorData.message
}
} catch {
if (errorText) {
return `JSM Forms API error: ${errorText}`
return errorText
}
}
return `JSM Forms API error: ${status} ${statusText}`
return `${status} ${statusText}`
}
Loading