MCPcopy Create free account
hub / github.com/SIMARSINGHRAYAT/Gitzo / handleGitError

Function handleGitError

src/utils/github.ts:162–171  ·  view source on GitHub ↗

Standard error handler for git operations

(res: Response, step: string)

Source from the content-addressed store, hash-verified

160
161/** Standard error handler for git operations */
162async function handleGitError(res: Response, step: string) {
163 const err = await res.json().catch(() => ({ message: res.statusText }));
164 if (res.status === 403 && err.message?.includes('Resource not accessible'))
165 throw new Error(`PERMISSION_DENIED: ${err.message}`);
166 if (res.status === 403 && (err.message?.includes('rate limit') || err.message?.includes('abuse')))
167 throw new Error(`RATE_LIMITED: ${err.message}`);
168 if (res.status === 401)
169 throw new Error(`PERMISSION_DENIED: Token expired or invalid (401 Unauthorized)`);
170 throw new Error(`${step}: ${err.message || `HTTP ${res.status}`}`);
171}
172
173export async function getDefaultBranchSHA(
174 token: string,

Callers 3

getDefaultBranchSHAFunction · 0.85
createFileOnBranchFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected