Skip to content

Commit 9c42989

Browse files
committed
Fix to throw error on file
Closes GH-20.
1 parent 98ad518 commit 9c42989

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export default function rehypeHighlight(options = {}) {
6464
name = pos > -1 ? prefix.slice(0, pos) : prefix
6565
}
6666

67-
return (tree) => {
67+
return (tree, file) => {
6868
// eslint-disable-next-line complexity
6969
visit(tree, 'element', (node, _, givenParent) => {
7070
const parent = /** @type {Node?} */ (givenParent)
@@ -108,7 +108,7 @@ export default function rehypeHighlight(options = {}) {
108108
} catch (error) {
109109
const exception = /** @type {Error} */ (error)
110110
if (!ignoreMissing || !/Unknown language/.test(exception.message)) {
111-
throw error
111+
file.fail(exception, node, 'rehype-highlight:missing-language')
112112
}
113113

114114
return

0 commit comments

Comments
 (0)