(error: CompositionEntryParseError)
| 177 | } |
| 178 | |
| 179 | function compositionEntryErrorMessage(error: CompositionEntryParseError): { |
| 180 | title: string; |
| 181 | message: string; |
| 182 | hint?: string; |
| 183 | } { |
| 184 | switch (error.kind) { |
| 185 | case "outside-project": |
| 186 | return { |
| 187 | title: "Invalid composition path", |
| 188 | message: `Entry file must stay inside the project directory: ${error.entryFile}`, |
| 189 | }; |
| 190 | case "not-found": |
| 191 | return { |
| 192 | title: "Composition not found", |
| 193 | message: `"${error.entryFile}" does not exist in the project directory.`, |
| 194 | hint: "Pass a path to a .html file relative to the project root (e.g. compositions/intro.html).", |
| 195 | }; |
| 196 | case "not-a-file": |
| 197 | return { |
| 198 | title: "Invalid composition path", |
| 199 | message: `"${error.entryFile}" is a directory, not an .html file.`, |
| 200 | hint: "Pass a path to a .html file (e.g. compositions/intro.html), or omit --composition to render index.html.", |
| 201 | }; |
| 202 | } |
| 203 | } |
| 204 | |
| 205 | /** |
| 206 | * Side-effecting wrapper around `parseCompositionEntryArg`. Exits the |
no outgoing calls
no test coverage detected