Skip to content

Improve error handling in Jira Cloud auth validation#2114

Merged
rmn-snpk merged 1 commit intomainfrom
fix/jira-auth-validation-error
Mar 12, 2026
Merged

Improve error handling in Jira Cloud auth validation#2114
rmn-snpk merged 1 commit intomainfrom
fix/jira-auth-validation-error

Conversation

@rmn-snpk
Copy link
Copy Markdown

@rmn-snpk rmn-snpk commented Mar 12, 2026

Fixes OPS-3427

image

@linear
Copy link
Copy Markdown

linear Bot commented Mar 12, 2026

@sonarqubecloud
Copy link
Copy Markdown

@rmn-snpk rmn-snpk marked this pull request as ready for review March 12, 2026 08:05
Copilot AI review requested due to automatic review settings March 12, 2026 08:05
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Improves Jira Cloud custom auth validation error handling so failed validation returns a safe error string instead of attempting to access nested HTTP response fields that may not exist (OPS-3427).

Changes:

  • Update Jira Cloud auth validate catch block to use the thrown error’s message with a fallback string.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

return {
valid: false,
error: ((e as HttpError).response.body as any).message,
error: (e as HttpError)?.message ?? 'Invalid credentials',
Copy link

Copilot AI Mar 12, 2026

Choose a reason for hiding this comment

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

HttpError.message is set to JSON.stringify({ response, request }) (see packages/blocks/common/src/lib/http/core/http-error.ts), so returning (e as HttpError)?.message will often surface a large JSON blob rather than a user-friendly message (and could include request details in other call sites). Since sendJiraRequest wraps HttpError into a plain Error(fullError) anyway, consider using runtime checks (e instanceof Error) and extracting/parsing Jira’s error body (e.g., errorMessages[0]) with a safe fallback.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

It's fine for Jira block

@rmn-snpk rmn-snpk marked this pull request as draft March 12, 2026 08:27
@rmn-snpk rmn-snpk marked this pull request as ready for review March 12, 2026 10:39
@rmn-snpk rmn-snpk merged commit 0f7c63c into main Mar 12, 2026
25 checks passed
@rmn-snpk rmn-snpk deleted the fix/jira-auth-validation-error branch March 12, 2026 10:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants