(errorMessage: string)
| 495 | } as const; |
| 496 | |
| 497 | function 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 | |
| 530 | export async function branchExistsOnRemote( |
| 531 | worktreePath: string, |
no outgoing calls
no test coverage detected