MCPcopy Create free account
hub / github.com/agent-tower/core / handleError

Function handleError

packages/server/src/routes/git.ts:14–32  ·  view source on GitHub ↗
(error: unknown, reply: any)

Source from the content-addressed store, hash-verified

12}
13
14function handleError(error: unknown, reply: any) {
15 if (error instanceof ZodError) {
16 reply.code(400);
17 return { error: 'Validation failed', code: 'VALIDATION_ERROR', details: error.errors };
18 }
19
20 if (error instanceof GitUnavailableError) {
21 reply.code(400);
22 return {
23 error: 'Git is not available for this working directory',
24 code: 'GIT_UNAVAILABLE',
25 workingDir: error.workingDir,
26 };
27 }
28
29 console.error('[git] Unhandled error:', error);
30 reply.code(500);
31 return { error: 'Internal server error', code: 'INTERNAL_ERROR' };
32}
33
34/** execFile promisified with timeout */
35function execGit(cwd: string, args: string[]): Promise<string> {

Callers 1

gitRoutesFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected