MCPcopy Index your code
hub / github.com/codeaashu/claude-code / getFileSystemErrorMessage

Function getFileSystemErrorMessage

src/utils/toolResultStorage.ts:1017–1040  ·  view source on GitHub ↗

* Get a human-readable error message from a filesystem error

(error: Error)

Source from the content-addressed store, hash-verified

1015 * Get a human-readable error message from a filesystem error
1016 */
1017function getFileSystemErrorMessage(error: Error): string {
1018 // Node.js filesystem errors have a 'code' property
1019 // eslint-disable-next-line no-restricted-syntax -- uses .path, not just .code
1020 const nodeError = error as NodeJS.ErrnoException
1021 if (nodeError.code) {
1022 switch (nodeError.code) {
1023 case 'ENOENT':
1024 return `Directory not found: ${nodeError.path ?? 'unknown path'}`
1025 case 'EACCES':
1026 return `Permission denied: ${nodeError.path ?? 'unknown path'}`
1027 case 'ENOSPC':
1028 return 'No space left on device'
1029 case 'EROFS':
1030 return 'Read-only file system'
1031 case 'EMFILE':
1032 return 'Too many open files'
1033 case 'EEXIST':
1034 return `File already exists: ${nodeError.path ?? 'unknown path'}`
1035 default:
1036 return `${nodeError.code}: ${nodeError.message}`
1037 }
1038 }
1039 return error.message
1040}
1041

Callers 1

persistToolResultFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected