Improve Jira connection error messages for better user experience#370
Merged
Conversation
Replace verbose HTML error dumps with concise, actionable error messages when Jira connection fails. The new error handling: - Extracts HTTP status codes from JIRAError exceptions - Provides specific guidance for common errors (401/403/404) - Shows authentication type and URL without HTML page dumps - Limits error text to 200 chars for unknown errors This significantly improves debugging experience by showing users exactly what went wrong instead of 500+ lines of HTML. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Reviewer's GuideRefines Jira connection error handling to provide concise, status-aware, and context-rich messages instead of generic authentication failures and verbose HTML dumps, while keeping the connection logic otherwise unchanged. Sequence diagram for improved Jira connection error handlingsequenceDiagram
actor User
participant JiraService as JiraConnection
participant JiraAPI as jira.JIRA
User->>JiraService: get_connection()
JiraService->>JiraAPI: jira.JIRA(url, auth, options)
JiraService->>JiraAPI: myself()
alt [connection succeeds]
JiraAPI-->>JiraService: user info
JiraService-->>User: JIRA instance
else jira.JIRAError with status_code 401
JiraAPI--xJiraService: jira.JIRAError(status_code=401)
JiraService-->>User: Exception(Authentication failed, check auth_type)
else jira.JIRAError with status_code 403
JiraAPI--xJiraService: jira.JIRAError(status_code=403)
JiraService-->>User: Exception(Access forbidden, insufficient permissions)
else jira.JIRAError with status_code 404
JiraAPI--xJiraService: jira.JIRAError(status_code=404)
JiraService-->>User: Exception(Jira instance not found, check URL)
else jira.JIRAError with other or no status_code
JiraAPI--xJiraService: jira.JIRAError
JiraService-->>User: Exception(HTTP status specific or truncated error, with auth_type and URL)
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- In the
jira.JIRAErrorhandling, consider including theauth_typein the 401/403 branches as well so users can immediately see which authentication mechanism failed without having to infer it from the deployment type. - Right now the original
jira.JIRAErrordetails are only exposed via exception chaining; if these HTML-heavy responses are still useful for deeper debugging, consider logging the raw error (at debug level) before raising the cleaned-up message.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In the `jira.JIRAError` handling, consider including the `auth_type` in the 401/403 branches as well so users can immediately see which authentication mechanism failed without having to infer it from the deployment type.
- Right now the original `jira.JIRAError` details are only exposed via exception chaining; if these HTML-heavy responses are still useful for deeper debugging, consider logging the raw error (at debug level) before raising the cleaned-up message.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replace verbose HTML error dumps with concise, actionable error messages when Jira connection fails. The new error handling:
This significantly improves debugging experience by showing users exactly what went wrong instead of 500+ lines of HTML.
🤖 Generated with Claude Code
Summary by Sourcery
Improve Jira connection error handling to provide concise, user-friendly feedback when authentication or connectivity fails.
Bug Fixes:
Enhancements: