-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Add API Error annotations to GitHub issue errors #1566
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -1175,7 +1175,11 @@ func CreateIssue(ctx context.Context, client *github.Client, owner string, repo | |||||
|
|
||||||
| issue, resp, err := client.Issues.Create(ctx, owner, repo, issueRequest) | ||||||
| if err != nil { | ||||||
| return utils.NewToolResultErrorFromErr("failed to create issue", err), nil | ||||||
| return ghErrors.NewGitHubAPIErrorResponse(ctx, | ||||||
| "failed to create issue", | ||||||
| resp, | ||||||
| err, | ||||||
| ), nil | ||||||
| } | ||||||
| defer func() { _ = resp.Body.Close() }() | ||||||
|
|
||||||
|
|
@@ -1522,7 +1526,11 @@ func ListIssues(t translations.TranslationHelperFunc) inventory.ServerTool { | |||||
|
|
||||||
| issueQuery := getIssueQueryType(hasLabels, hasSince) | ||||||
| if err := client.Query(ctx, issueQuery, vars); err != nil { | ||||||
| return utils.NewToolResultError(err.Error()), nil, nil | ||||||
| return ghErrors.NewGitHubGraphQLErrorResponse( | ||||||
| ctx, | ||||||
| "failed to list issues", | ||||||
| err, | ||||||
| ), nil, nil | ||||||
| } | ||||||
|
|
||||||
| // Extract and convert all issue nodes using the common interface | ||||||
|
|
@@ -1683,7 +1691,7 @@ func AssignCopilotToIssue(t translations.TranslationHelperFunc) inventory.Server | |||||
| var query suggestedActorsQuery | ||||||
| err := client.Query(ctx, &query, variables) | ||||||
| if err != nil { | ||||||
| return nil, nil, err | ||||||
| return ghErrors.NewGitHubGraphQLErrorResponse(ctx, "failed to get suggested actors", err), nil, nil | ||||||
|
||||||
| return ghErrors.NewGitHubGraphQLErrorResponse(ctx, "failed to get suggested actors", err), nil, nil | |
| return ghErrors.NewGitHubGraphQLErrorResponse(ctx, "Failed to get suggested actors", err), nil, nil |
Copilot
AI
Dec 18, 2025
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.
Error message capitalization is inconsistent. The message "failed to get issue ID" uses lowercase "failed", while other nearby error messages in this file use uppercase "Failed" (e.g., "Failed to get issue labels" at line 518, "Failed to find issues" at line 1265). For consistency, this should use "Failed to get issue ID" with an uppercase F to match the existing pattern in this file.
| return ghErrors.NewGitHubGraphQLErrorResponse(ctx, "failed to get issue ID", err), nil, nil | |
| return ghErrors.NewGitHubGraphQLErrorResponse(ctx, "Failed to get issue ID", err), nil, nil |
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.
Error message capitalization is inconsistent. The message "failed to list issues" uses lowercase "failed", while other nearby error messages in this file use uppercase "Failed" (e.g., "Failed to get issue labels" at line 518, "Failed to find issues" at line 1265). For consistency, this should use "Failed to list issues" with an uppercase F to match the existing pattern in this file.