From ee1e20bd149f6aec960624df49475e419ff8782e Mon Sep 17 00:00:00 2001 From: Travis Eden Date: Mon, 24 Sep 2018 09:26:16 -0400 Subject: [PATCH] handle exceptions together --- server/controllers/api/claim/publish/index.js | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/server/controllers/api/claim/publish/index.js b/server/controllers/api/claim/publish/index.js index 7fa525d0..f51d4055 100644 --- a/server/controllers/api/claim/publish/index.js +++ b/server/controllers/api/claim/publish/index.js @@ -102,13 +102,7 @@ const claimPublish = ({ body, files, headers, ip, originalUrl, user, tor }, res) sendGATimingEvent('end-to-end', 'publish', fileType, gaStartTime, Date.now()); }) .catch(error => { - if (error.name === CLAIM_TAKEN) { - res.status(400).json({ - success: false, - message: error.message, - }); - } - if (error.name === UNAPPROVED_CHANNEL) { + if ([CLAIM_TAKEN, UNAPPROVED_CHANNEL].includes(error.name)) { res.status(400).json({ success: false, message: error.message,