Standard error handler for git operations
(res: Response, step: string)
| 160 | |
| 161 | /** Standard error handler for git operations */ |
| 162 | async 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 | |
| 173 | export async function getDefaultBranchSHA( |
| 174 | token: string, |
no outgoing calls
no test coverage detected