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
Prev Previous commit
fix(tools): handle all Atlassian error formats in error extractor
Add RFC 7807 errors[].title format (Confluence v2, Forms/ProForma API)
and Jira field-level errors object to the atlassian-errors extractor.
  • Loading branch information
waleedlatif1 committed Apr 9, 2026
commit 83ea42f8368df04ebd674e6a56df93fe05d76b4c
22 changes: 20 additions & 2 deletions apps/sim/tools/error-extractors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,36 @@ export interface ErrorExtractorConfig {
const ERROR_EXTRACTORS: ErrorExtractorConfig[] = [
{
id: 'atlassian-errors',
description: 'Atlassian REST API error formats (errorMessage, errorMessages array, message)',
examples: ['Jira', 'Jira Service Management', 'Confluence'],
description:
'Atlassian REST API error formats (errorMessage, errorMessages, errors[].title, message)',
examples: ['Jira', 'Jira Service Management', 'Confluence', 'JSM Forms/ProForma'],
extract: (errorInfo) => {
// JSM Service Desk: singular errorMessage string
if (errorInfo?.data?.errorMessage) {
return errorInfo.data.errorMessage
}
// Jira Platform: errorMessages array
if (
Array.isArray(errorInfo?.data?.errorMessages) &&
errorInfo.data.errorMessages.length > 0
) {
return errorInfo.data.errorMessages.join(', ')
}
// Confluence v2 / Forms API: RFC 7807 errors array with title/detail
if (Array.isArray(errorInfo?.data?.errors) && errorInfo.data.errors.length > 0) {
Comment on lines +46 to +60
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 Use ErrorExtractorId constant for type safety

All 95 Atlassian tool files use the string literal 'atlassian-errors' rather than the ErrorExtractorId.ATLASSIAN_ERRORS constant exported from this file. Other integrations (e.g., Telegram tools) consistently use ErrorExtractorId.TELEGRAM_DESCRIPTION. A typo in a string literal would silently fall back to the generic "Request failed with status X" message, whereas the constant provides compile-time safety.

const err = errorInfo.data.errors[0]
if (err?.title) {
return err.detail ? `${err.title}: ${err.detail}` : err.title
}
}
Comment on lines +60 to +65
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 RFC 7807 errors array silently drops detail when title is absent

If errors is a non-empty array but the first entry carries detail without a title (permissible under RFC 7807, which makes title optional), the inner if (err?.title) block is skipped without returning. Because errors IS an array, the field-level object check (!Array.isArray) is also skipped, so the extractor falls through to data.message and ultimately returns undefined. The detail text is silently lost and the executor surfaces "Request failed with status X" instead.

Suggested change
if (Array.isArray(errorInfo?.data?.errors) && errorInfo.data.errors.length > 0) {
const err = errorInfo.data.errors[0]
if (err?.title) {
return err.detail ? `${err.title}: ${err.detail}` : err.title
}
}
if (Array.isArray(errorInfo?.data?.errors) && errorInfo.data.errors.length > 0) {
const err = errorInfo.data.errors[0]
if (err?.title) {
return err.detail ? `${err.title}: ${err.detail}` : err.title
}
if (err?.detail) {
return err.detail
}
}

// Jira Platform field-level errors object
if (errorInfo?.data?.errors && !Array.isArray(errorInfo.data.errors)) {
const fieldErrors = Object.entries(errorInfo.data.errors)
.map(([field, msg]) => `${field}: ${msg}`)
.join(', ')
if (fieldErrors) return fieldErrors
}
// Generic message fallback (auth/gateway errors)
if (errorInfo?.data?.message) {
return errorInfo.data.message
Comment thread
waleedlatif1 marked this conversation as resolved.
}
Expand Down
Loading