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

Function linkWriteError

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

Source from the content-addressed store, hash-verified

174}
175
176function linkWriteError(link: string, target: string, cause: unknown): Error {
177 const code = (cause as NodeJS.ErrnoException | undefined)?.code;
178 const why = code === 'ENOENT' ? 'its folder does not exist'
179 : code === 'EACCES' || code === 'EROFS' ? 'it is read-only'
180 : code === 'EPERM' || code === 'EBUSY' ? 'it is read-only or in use'
181 : cause instanceof Error ? cause.message : String(cause);
182 const message = target === link
183 ? `${link} is a symbolic link that can't be followed (${why}).`
184 : `${link} is a symbolic link to ${target}, which can't be written (${why}).`;
185 return Object.assign(
186 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 }),
187 { code },
188 );
189}
190
191/**
192 * 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