( cg: CodeGraph, projectRoot: string, requested: string )
| 109 | * @throws {ApiError} `not-found` when it is fine but not in the index. |
| 110 | */ |
| 111 | export function resolveRequestedFile( |
| 112 | cg: CodeGraph, |
| 113 | projectRoot: string, |
| 114 | requested: string |
| 115 | ): { record: FileRecord; storedPath: string; absolute: string } { |
| 116 | const posix = toRequestPath(requested); |
| 117 | // Refusals happen here, ahead of everything. The read and the index lookup |
| 118 | // below use the same string, so a `%` in a file's name means the same file |
| 119 | // to both (#2009). |
| 120 | const absolute = resolveProjectFile(projectRoot, posix); |
| 121 | |
| 122 | const found = findIndexedFile(cg, posix); |
| 123 | if (!found) throw notIndexedError(posix); |
| 124 | return { ...found, absolute }; |
| 125 | } |
| 126 | |
| 127 | export function notIndexedError(file: string): ApiError { |
| 128 | return notFound( |
no test coverage detected