Updated test email to throw error for failed requests

no issue
This commit is contained in:
Rish 2019-11-18 13:24:28 +05:30
parent a64fab7e69
commit baccbb4942

View File

@ -60,7 +60,13 @@ module.exports = {
}
const post = model.toJSON();
const {emails = []} = frame.data;
return mega.mega.sendTestEmail(post, emails);
const response = await mega.mega.sendTestEmail(post, emails);
if (response && response[0] && response[0].error) {
throw new common.errors.EmailError({
message: response[0].error.message
});
}
return response;
}
}
};