handle exceptions together

This commit is contained in:
Travis Eden 2018-09-24 09:26:16 -04:00
parent 7fd0e66d9b
commit ee1e20bd14

View file

@ -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,