MCPcopy
hub / github.com/21st-dev/1code / categorizeGitError

Function categorizeGitError

src/main/lib/git/worktree.ts:497–528  ·  view source on GitHub ↗
(errorMessage: string)

Source from the content-addressed store, hash-verified

495} as const;
496
497function categorizeGitError(errorMessage: string): BranchExistsResult {
498 const lowerMessage = errorMessage.toLowerCase();
499
500 if (GIT_ERROR_PATTERNS.network.some((p) => lowerMessage.includes(p))) {
501 return {
502 status: "error",
503 message: "Cannot connect to remote. Check your network connection.",
504 };
505 }
506
507 if (GIT_ERROR_PATTERNS.auth.some((p) => lowerMessage.includes(p))) {
508 return {
509 status: "error",
510 message: "Authentication failed. Check your Git credentials.",
511 };
512 }
513
514 if (
515 GIT_ERROR_PATTERNS.remoteNotConfigured.some((p) => lowerMessage.includes(p))
516 ) {
517 return {
518 status: "error",
519 message:
520 "Remote 'origin' is not configured or the repository was not found.",
521 };
522 }
523
524 return {
525 status: "error",
526 message: `Failed to verify branch: ${errorMessage}`,
527 };
528}
529
530export async function branchExistsOnRemote(
531 worktreePath: string,

Callers 1

branchExistsOnRemoteFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected