give error to user if url to name failed
This commit is contained in:
parent
8659289bef
commit
51c2ee3ecc
1 changed files with 3 additions and 1 deletions
|
@ -46,7 +46,9 @@ module.exports = (db) => {
|
||||||
let productData;
|
let productData;
|
||||||
try {
|
try {
|
||||||
if (isUrl) productData = await getProductName(req.body.itemUrlOrName, config.proxyServer);
|
if (isUrl) productData = await getProductName(req.body.itemUrlOrName, config.proxyServer);
|
||||||
} catch (err) {}
|
} catch (err) {
|
||||||
|
req.flash('error', err.toString());
|
||||||
|
}
|
||||||
item.name = (productData ? productData.name : req.body.itemUrlOrName);
|
item.name = (productData ? productData.name : req.body.itemUrlOrName);
|
||||||
item.addedBy = req.user._id;
|
item.addedBy = req.user._id;
|
||||||
item.pledgedBy = (req.user._id === req.params.user ? undefined : req.user._id);
|
item.pledgedBy = (req.user._id === req.params.user ? undefined : req.user._id);
|
||||||
|
|
Loading…
Reference in a new issue