-
Notifications
You must be signed in to change notification settings - Fork 3.5k
fix(tools): add Atlassian error extractor to all Jira, JSM, and Confluence tools #4085
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
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
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -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) { | ||||||||||||||||||||||||||||||||
| const err = errorInfo.data.errors[0] | ||||||||||||||||||||||||||||||||
| if (err?.title) { | ||||||||||||||||||||||||||||||||
| return err.detail ? `${err.title}: ${err.detail}` : err.title | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
Comment on lines
+60
to
+65
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
If
Suggested change
|
||||||||||||||||||||||||||||||||
| // 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 | ||||||||||||||||||||||||||||||||
|
waleedlatif1 marked this conversation as resolved.
|
||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ErrorExtractorIdconstant for type safetyAll 95 Atlassian tool files use the string literal
'atlassian-errors'rather than theErrorExtractorId.ATLASSIAN_ERRORSconstant exported from this file. Other integrations (e.g., Telegram tools) consistently useErrorExtractorId.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.