From 59c167e31b6439985fb66b54f220ab2dd2f8c00f Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Wed, 17 Mar 2021 18:35:16 -0400 Subject: [PATCH] ExportHandler: Replace unnecessary exception with `return` --- src/node/handler/ExportHandler.js | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/node/handler/ExportHandler.js b/src/node/handler/ExportHandler.js index f84c53ad1..ea8dd4466 100644 --- a/src/node/handler/ExportHandler.js +++ b/src/node/handler/ExportHandler.js @@ -43,7 +43,7 @@ const tempDirectory = os.tmpdir(); /** * do a requested export */ -const doExport = async (req, res, padId, readOnlyId, type) => { +exports.doExport = async (req, res, padId, readOnlyId, type) => { // avoid naming the read-only file as the original pad's id let fileName = readOnlyId ? readOnlyId : padId; @@ -78,7 +78,7 @@ const doExport = async (req, res, padId, readOnlyId, type) => { const newHTML = await hooks.aCallFirst('exportHTMLSend', html); if (newHTML.length) html = newHTML; res.send(html); - throw 'stop'; + return; } // else write the html export to a file @@ -121,11 +121,3 @@ const doExport = async (req, res, padId, readOnlyId, type) => { await fsp_unlink(destFile); } }; - -exports.doExport = (req, res, padId, readOnlyId, type) => { - doExport(req, res, padId, readOnlyId, type).catch((err) => { - if (err !== 'stop') { - throw err; - } - }); -};