@@ -1175,7 +1175,11 @@ func CreateIssue(ctx context.Context, client *github.Client, owner string, repo
11751175
11761176 issue , resp , err := client .Issues .Create (ctx , owner , repo , issueRequest )
11771177 if err != nil {
1178- return utils .NewToolResultErrorFromErr ("failed to create issue" , err ), nil
1178+ return ghErrors .NewGitHubAPIErrorResponse (ctx ,
1179+ "failed to create issue" ,
1180+ resp ,
1181+ err ,
1182+ ), nil
11791183 }
11801184 defer func () { _ = resp .Body .Close () }()
11811185
@@ -1522,7 +1526,11 @@ func ListIssues(t translations.TranslationHelperFunc) inventory.ServerTool {
15221526
15231527 issueQuery := getIssueQueryType (hasLabels , hasSince )
15241528 if err := client .Query (ctx , issueQuery , vars ); err != nil {
1525- return utils .NewToolResultError (err .Error ()), nil , nil
1529+ return ghErrors .NewGitHubGraphQLErrorResponse (
1530+ ctx ,
1531+ "failed to list issues" ,
1532+ err ,
1533+ ), nil , nil
15261534 }
15271535
15281536 // Extract and convert all issue nodes using the common interface
@@ -1683,7 +1691,7 @@ func AssignCopilotToIssue(t translations.TranslationHelperFunc) inventory.Server
16831691 var query suggestedActorsQuery
16841692 err := client .Query (ctx , & query , variables )
16851693 if err != nil {
1686- return nil , nil , err
1694+ return ghErrors . NewGitHubGraphQLErrorResponse ( ctx , "failed to get suggested actors" , err ), nil , nil
16871695 }
16881696
16891697 // Iterate all the returned nodes looking for the copilot bot, which is supposed to have the
@@ -1729,7 +1737,7 @@ func AssignCopilotToIssue(t translations.TranslationHelperFunc) inventory.Server
17291737 }
17301738
17311739 if err := client .Query (ctx , & getIssueQuery , variables ); err != nil {
1732- return utils . NewToolResultError ( fmt . Sprintf ( "failed to get issue ID: %v " , err ) ), nil , nil
1740+ return ghErrors . NewGitHubGraphQLErrorResponse ( ctx , "failed to get issue ID" , err ), nil , nil
17331741 }
17341742
17351743 // Finally, do the assignment. Just for reference, assigning copilot to an issue that it is already
0 commit comments