* 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, )
| 18 | * noisy output during normal operation. |
| 19 | */ |
| 20 | function 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 | |
| 41 | export const DEFAULT_MAX_FILES = 10_000 |
| 42 |
no outgoing calls
no test coverage detected