Skip to content

Commit 5bbc163

Browse files
authored
Merge pull request #771 from microlinkhq/readability
chore(readability): avoid errors propagation
2 parents e8ac311 + 67ce2b1 commit 5bbc163

File tree

1 file changed

+7
-1
lines changed
  • packages/metascraper-readability/src

1 file changed

+7
-1
lines changed

packages/metascraper-readability/src/worker.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,15 @@ const parseReader = reader => {
1111
}
1212
}
1313

14+
const errorCapture =
15+
process.env.NODE_ENV === 'test' ? 'tryAndCatch' : 'processLevel'
16+
1417
const getDocument = ({ url, html }) => {
1518
const { Window } = require('happy-dom')
16-
const window = new Window({ url })
19+
const window = new Window({
20+
url,
21+
settings: { errorCapture }
22+
})
1723
const document = window.document
1824
document.write(html)
1925
return document

0 commit comments

Comments
 (0)