Skip to content

Commit 83ea42f

Browse files
committed
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.
1 parent 84ecfa5 commit 83ea42f

1 file changed

Lines changed: 20 additions & 2 deletions

File tree

apps/sim/tools/error-extractors.ts

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,18 +41,36 @@ export interface ErrorExtractorConfig {
4141
const ERROR_EXTRACTORS: ErrorExtractorConfig[] = [
4242
{
4343
id: 'atlassian-errors',
44-
description: 'Atlassian REST API error formats (errorMessage, errorMessages array, message)',
45-
examples: ['Jira', 'Jira Service Management', 'Confluence'],
44+
description:
45+
'Atlassian REST API error formats (errorMessage, errorMessages, errors[].title, message)',
46+
examples: ['Jira', 'Jira Service Management', 'Confluence', 'JSM Forms/ProForma'],
4647
extract: (errorInfo) => {
48+
// JSM Service Desk: singular errorMessage string
4749
if (errorInfo?.data?.errorMessage) {
4850
return errorInfo.data.errorMessage
4951
}
52+
// Jira Platform: errorMessages array
5053
if (
5154
Array.isArray(errorInfo?.data?.errorMessages) &&
5255
errorInfo.data.errorMessages.length > 0
5356
) {
5457
return errorInfo.data.errorMessages.join(', ')
5558
}
59+
// Confluence v2 / Forms API: RFC 7807 errors array with title/detail
60+
if (Array.isArray(errorInfo?.data?.errors) && errorInfo.data.errors.length > 0) {
61+
const err = errorInfo.data.errors[0]
62+
if (err?.title) {
63+
return err.detail ? `${err.title}: ${err.detail}` : err.title
64+
}
65+
}
66+
// Jira Platform field-level errors object
67+
if (errorInfo?.data?.errors && !Array.isArray(errorInfo.data.errors)) {
68+
const fieldErrors = Object.entries(errorInfo.data.errors)
69+
.map(([field, msg]) => `${field}: ${msg}`)
70+
.join(', ')
71+
if (fieldErrors) return fieldErrors
72+
}
73+
// Generic message fallback (auth/gateway errors)
5674
if (errorInfo?.data?.message) {
5775
return errorInfo.data.message
5876
}

0 commit comments

Comments
 (0)