Skip to content

Commit 43c2194

Browse files
add error handling for the apiIndex copy operation
1 parent f41a39e commit 43c2194

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

cli/cli.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -141,12 +141,17 @@ async function buildProject(program: Command): Promise<DocsConfig | undefined> {
141141
})
142142

143143
// copy the apiIndex.json file to the docs directory so it can be served as a static asset
144-
const apiIndexPath = join(absoluteOutputDir, 'apiIndex.json')
145-
const docsApiIndexPath = join(absoluteOutputDir, 'docs', 'apiIndex.json')
146-
await copyFile(apiIndexPath, docsApiIndexPath)
144+
try {
145+
const apiIndexPath = join(absoluteOutputDir, 'apiIndex.json')
146+
const docsApiIndexPath = join(absoluteOutputDir, 'docs', 'apiIndex.json')
147+
await copyFile(apiIndexPath, docsApiIndexPath)
147148

148-
if (verbose) {
149-
console.log('Copied apiIndex.json to docs directory')
149+
if (verbose) {
150+
console.log('Copied apiIndex.json to docs directory')
151+
}
152+
} catch (error) {
153+
console.error('Failed to copy apiIndex.json to docs directory:', error)
154+
throw error
150155
}
151156

152157
return config

0 commit comments

Comments
 (0)