Skip to content

Commit

Permalink
refactor(plugins): explicitly catch promise rejections
Browse files Browse the repository at this point in the history
  • Loading branch information
Fdawgs committed Jun 14, 2022
1 parent f2c1892 commit 196fd9f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/plugins/embed-html-images/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ async function plugin(server, options) {
)
);
})
);
).catch((err) => {
throw err;
});

return dom.serialize();
}
Expand Down
5 changes: 5 additions & 0 deletions src/plugins/pdf-to-txt/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,11 @@ async function plugin(server, options) {
.addJob("recognize", file)
.then((result) => result?.data?.text)
)
).catch(
/* istanbul ignore next: unable to test unknown errors */
(err) => {
throw err;
}
);

req.conversionResults.body = results.join(" ");
Expand Down
7 changes: 6 additions & 1 deletion src/plugins/tidy-html/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,12 @@ async function plugin(server) {
sortAttributes: "alpha",
};

const results = await tidyP(parsedHtml, config);
const results = await tidyP(parsedHtml, config).catch(
/* istanbul ignore next: unable to test unknown errors */
(err) => {
throw err;
}
);
return results;
}

Expand Down

0 comments on commit 196fd9f

Please sign in to comment.