MCPcopy
hub / github.com/github/github-mcp-server / NewGitHubRawAPIErrorResponse

Function NewGitHubRawAPIErrorResponse

pkg/errors/error.go:206–212  ·  view source on GitHub ↗

NewGitHubRawAPIErrorResponse returns an mcp.NewToolResultError and retains the error in the context for access via middleware

(ctx context.Context, message string, resp *http.Response, err error)

Source from the content-addressed store, hash-verified

204
205// NewGitHubRawAPIErrorResponse returns an mcp.NewToolResultError and retains the error in the context for access via middleware
206func NewGitHubRawAPIErrorResponse(ctx context.Context, message string, resp *http.Response, err error) *mcp.CallToolResult {
207 rawErr := newGitHubRawAPIError(message, resp, err)
208 if ctx != nil {
209 _, _ = addRawAPIErrorToContext(ctx, rawErr) // Explicitly ignore error for graceful handling
210 }
211 return utils.NewToolResultErrorFromErr(message, err)
212}
213
214// NewGitHubAPIStatusErrorResponse handles cases where the API call succeeds (err == nil)
215// but returns an unexpected HTTP status code. It creates a synthetic error from the

Callers

nothing calls this directly

Calls 3

newGitHubRawAPIErrorFunction · 0.85
addRawAPIErrorToContextFunction · 0.85

Tested by

no test coverage detected