MCPcopy
hub / github.com/generalaction/emdash / classifyCloneRepositoryError

Function classifyCloneRepositoryError

packages/core/src/git/errors.ts:87–110  ·  view source on GitHub ↗
(
  error: unknown,
  targetPath: string
)

Source from the content-addressed store, hash-verified

85}
86
87export function classifyCloneRepositoryError(
88 error: unknown,
89 targetPath: string
90): CloneRepositoryError {
91 const commandError = toGitCommandError(error);
92 const message = commandError.message.toLowerCase();
93 if (
94 message.includes('already exists and is not an empty directory') ||
95 (message.includes('destination path') && message.includes('already exists'))
96 ) {
97 return { type: 'target_exists', path: targetPath, message: commandError.message };
98 }
99 if (message.includes('authentication') || message.includes('permission denied')) {
100 return { type: 'auth_failed', message: commandError.message };
101 }
102 if (
103 message.includes('repository not found') ||
104 message.includes('does not appear to be a git repository') ||
105 message.includes('not found')
106 ) {
107 return { type: 'remote_not_found', message: commandError.message };
108 }
109 return commandError;
110}
111
112export function classifyFetchError(error: unknown, remote: string | undefined): FetchError {
113 const commandError = toGitCommandError(error);

Callers 2

cloneRepositoryMethod · 0.90
cloneRepositoryMethod · 0.90

Calls 1

toGitCommandErrorFunction · 0.85

Tested by

no test coverage detected