added error chck for file sending

This commit is contained in:
bill bittner 2018-05-04 11:36:09 -07:00
parent d817ab02b0
commit 7044a09cd6

View file

@ -8,7 +8,12 @@ const serveFile = ({ filePath, fileType }, res) => {
'Content-Type' : fileType || 'image/jpeg', 'Content-Type' : fileType || 'image/jpeg',
}, },
}; };
res.status(200).sendFile(filePath, sendFileOptions); res.status(200).sendFile(filePath, sendFileOptions, (error) => {
if (error) {
logger.warn(error);
res.status(404).send();
}
});
}; };
module.exports = serveFile; module.exports = serveFile;