Skip to content

Commit a67570f

Browse files
committed
refactor: show an error if 'capture' is undefined.
1 parent eb0b0e9 commit a67570f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

packages/docs/src/components/ScssDocs.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,11 @@ const ScssDocs = ({ file, capture }: ScssDocsProps) => {
3535
const captureEnd = `// scss-docs-end ${capture}`
3636
const re = new RegExp(`${captureStart}((?:.|\n)*)${captureEnd}`)
3737
const captured = re.exec(_file.node.internal.content)
38-
const code = captured && captured[1].trim()
38+
const code = captured ? captured[1].trim() : undefined
39+
40+
if (code === undefined) {
41+
console.error(`Can't find "${capture}" in ${_file.node.relativePath}`)
42+
}
3943

4044
return (
4145
code && (

0 commit comments

Comments
 (0)