MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / linkWriteError

Function linkWriteError

src/installer/targets/shared.ts:175–188  ·  view source on GitHub ↗
(link: string, target: string, cause: unknown)

Source from the content-addressed store, hash-verified

173}
174
175function linkWriteError(link: string, target: string, cause: unknown): Error {
176 const code = (cause as NodeJS.ErrnoException | undefined)?.code;
177 const why = code === 'ENOENT' ? 'its folder does not exist'
178 : code === 'EACCES' || code === 'EROFS' ? 'it is read-only'
179 : code === 'EPERM' || code === 'EBUSY' ? 'it is read-only or in use'
180 : cause instanceof Error ? cause.message : String(cause);
181 const message = target === link
182 ? `${link} is a symbolic link that can't be followed (${why}).`
183 : `${link} is a symbolic link to ${target}, which can't be written (${why}).`;
184 return Object.assign(
185 new Error(`${message} CodeGraph writes through links and never replaces one with a copy: fix the link or make its file writable, then run this again.`, { cause }),
186 { code },
187 );
188}
189
190/**
191 * Delete a file that codegraph's change left with nothing of the user's in

Callers 1

atomicWriteFileSyncFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected