NewGitHubAPIStatusErrorResponse handles cases where the API call succeeds (err == nil) but returns an unexpected HTTP status code. It creates a synthetic error from the status code and response body, then records it in context for observability tracking.
(ctx context.Context, message string, resp *github.Response, body []byte)
| 215 | // but returns an unexpected HTTP status code. It creates a synthetic error from the |
| 216 | // status code and response body, then records it in context for observability tracking. |
| 217 | func NewGitHubAPIStatusErrorResponse(ctx context.Context, message string, resp *github.Response, body []byte) *mcp.CallToolResult { |
| 218 | err := fmt.Errorf("unexpected status %d: %s", resp.StatusCode, string(body)) |
| 219 | return NewGitHubAPIErrorResponse(ctx, message, resp, err) |
| 220 | } |