@@ -1161,7 +1161,11 @@ func CreateIssue(ctx context.Context, client *github.Client, owner string, repo
11611161
11621162 issue , resp , err := client .Issues .Create (ctx , owner , repo , issueRequest )
11631163 if err != nil {
1164- return utils .NewToolResultErrorFromErr ("failed to create issue" , err ), nil
1164+ return ghErrors .NewGitHubAPIErrorResponse (ctx ,
1165+ "failed to create issue" ,
1166+ resp ,
1167+ err ,
1168+ ), nil
11651169 }
11661170 defer func () { _ = resp .Body .Close () }()
11671171
@@ -1495,7 +1499,11 @@ func ListIssues(getGQLClient GetGQLClientFn, t translations.TranslationHelperFun
14951499
14961500 issueQuery := getIssueQueryType (hasLabels , hasSince )
14971501 if err := client .Query (ctx , issueQuery , vars ); err != nil {
1498- return utils .NewToolResultError (err .Error ()), nil , nil
1502+ return ghErrors .NewGitHubGraphQLErrorResponse (
1503+ ctx ,
1504+ "failed to list issues" ,
1505+ err ,
1506+ ), nil , nil
14991507 }
15001508
15011509 // Extract and convert all issue nodes using the common interface
@@ -1653,6 +1661,7 @@ func AssignCopilotToIssue(getGQLClient GetGQLClientFn, t translations.Translatio
16531661 var query suggestedActorsQuery
16541662 err := client .Query (ctx , & query , variables )
16551663 if err != nil {
1664+ _ , _ = ghErrors .NewGitHubGraphQLErrorToCtx (ctx , "failed to get suggested actors" , err )
16561665 return nil , nil , err
16571666 }
16581667
@@ -1699,7 +1708,7 @@ func AssignCopilotToIssue(getGQLClient GetGQLClientFn, t translations.Translatio
16991708 }
17001709
17011710 if err := client .Query (ctx , & getIssueQuery , variables ); err != nil {
1702- return utils . NewToolResultError ( fmt . Sprintf ( "failed to get issue ID: %v " , err ) ), nil , nil
1711+ return ghErrors . NewGitHubGraphQLErrorResponse ( ctx , "failed to get issue ID" , err ), nil , nil
17031712 }
17041713
17051714 // Finally, do the assignment. Just for reference, assigning copilot to an issue that it is already
0 commit comments