Commit 3ca83202 authored by Alf Eaton's avatar Alf Eaton

Catch more processing errors/warnings

parent bb060efc
......@@ -125,11 +125,18 @@ class HTMLEPUB {
tidy.tidyBuffer(html, options, (err, result) => {
if (err) {
reject(err)
} else if (!result.output) {
reject(new Error('The document failed to parse'))
} else {
console.warn(result.errlog)
const $ = cheerio.load(result.output)
$('title').text(epub.book.title)
resolve($)
try {
const $ = cheerio.load(result.output)
$('title').text(epub.book.title)
resolve($)
} catch (err) {
console.error(err)
reject(new Error('There was an error loading the document'))
}
}
})
})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment