MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / logFileTreeError

Function logFileTreeError

common/src/project-file-tree.ts:20–39  ·  view source on GitHub ↗

* Logs file tree errors in debug mode only. * Errors are logged but not thrown to preserve tree-building behavior. * * File tree operations commonly encounter expected errors (permissions, * deleted files) that are not fatal. We only log in debug mode to avoid * noisy output during normal opera

(
  operation: string,
  filePath: string,
  error: unknown,
)

Source from the content-addressed store, hash-verified

18 * noisy output during normal operation.
19 */
20function logFileTreeError(
21 operation: string,
22 filePath: string,
23 error: unknown,
24): void {
25 // Only log in debug mode to avoid noisy output
26 if (!process.env.DEBUG && !process.env.CODEBUFF_DEBUG) {
27 return
28 }
29
30 const err = error as { code?: string } | undefined
31 const code = err?.code
32 const errorMessage = error instanceof Error ? error.message : String(error)
33
34 console.debug(
35 `[FileTree] ${operation} failed for "${filePath}"${
36 code ? ` (${code})` : ''
37 }: ${errorMessage}`,
38 )
39}
40
41export const DEFAULT_MAX_FILES = 10_000
42

Callers 2

getProjectFileTreeFunction · 0.85
parseGitignoreFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected