Skip to content
This repository was archived by the owner on Jul 30, 2025. It is now read-only.

Commit c725248

Browse files
committed
fix(plugins/plugin-client-common): snippet inliner recursion sometimes fails
we arent catching some errors in a Promise.all, resulting in *none* of the options executing to completion.
1 parent a30727e commit c725248

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

plugins/plugin-client-common/src/controller/snippets.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,14 @@ export default function inlineSnippets(snippetBasePath?: string) {
8282
const snippetFileName = match[3]
8383

8484
const getBasePath = (snippetBasePath: string) => {
85-
const basePath = match[5] || snippetBasePath
86-
87-
return isAbsolute(basePath) ? basePath : srcFilePath ? join(srcFilePath, basePath) : undefined
85+
try {
86+
const basePath = match[5] || snippetBasePath
87+
88+
return isAbsolute(basePath) ? basePath : srcFilePath ? join(srcFilePath, basePath) : undefined
89+
} catch (err) {
90+
debug(err)
91+
return undefined
92+
}
8893
}
8994

9095
// Call ourselves recursively, in case a fetched snippet
@@ -116,6 +121,7 @@ export default function inlineSnippets(snippetBasePath?: string) {
116121
await Promise.all(
117122
candidates
118123
.map(getBasePath)
124+
.filter(Boolean)
119125
.map(myBasePath => ({
120126
myBasePath,
121127
filepath: join(myBasePath, snippetFileName)

0 commit comments

Comments
 (0)