feat: refs #7027 mailError managed #2612

Merged
jgallego merged 1 commits from 7027-mailError into dev 2024-06-19 13:29:58 +00:00
4 changed files with 14 additions and 7 deletions
Showing only changes of commit b2ad449809 - Show all commits

View File

@ -232,5 +232,6 @@
"Incoterms and Customs agent are required for a non UEE member": "Incoterms and Customs agent are required for a non UEE member", "Incoterms and Customs agent are required for a non UEE member": "Incoterms and Customs agent are required for a non UEE member",
"It has been invoiced but the PDF could not be generated": "It has been invoiced but the PDF could not be generated", "It has been invoiced but the PDF could not be generated": "It has been invoiced but the PDF could not be generated",
"It has been invoiced but the PDF of refund not be generated": "It has been invoiced but the PDF of refund not be generated", "It has been invoiced but the PDF of refund not be generated": "It has been invoiced but the PDF of refund not be generated",
"Cannot add holidays on this day": "Cannot add holidays on this day" "Cannot add holidays on this day": "Cannot add holidays on this day",
"Cannot send mail": "Cannot send mail"
} }

View File

@ -365,5 +365,6 @@
"You can only have one PDA": "Solo puedes tener un PDA", "You can only have one PDA": "Solo puedes tener un PDA",
"It has been invoiced but the PDF could not be generated": "Se ha facturado pero no se ha podido generar el PDF", "It has been invoiced but the PDF could not be generated": "Se ha facturado pero no se ha podido generar el PDF",
"It has been invoiced but the PDF of refund not be generated": "Se ha facturado pero no se ha podido generar el PDF del abono", "It has been invoiced but the PDF of refund not be generated": "Se ha facturado pero no se ha podido generar el PDF del abono",
"Payment method is required": "El método de pago es obligatorio" "Payment method is required": "El método de pago es obligatorio",
"Cannot send mail": "Não é possível enviar o email"
} }

View File

@ -359,5 +359,6 @@
"Select ticket or client": "Choisissez un ticket ou un client", "Select ticket or client": "Choisissez un ticket ou un client",
"It was not able to create the invoice": "Il n'a pas été possible de créer la facture", "It was not able to create the invoice": "Il n'a pas été possible de créer la facture",
"It has been invoiced but the PDF could not be generated": "La facture a été émise mais le PDF n'a pas pu être généré", "It has been invoiced but the PDF could not be generated": "La facture a été émise mais le PDF n'a pas pu être généré",
"It has been invoiced but the PDF of refund not be generated": "Il a été facturé mais le PDF de remboursement n'a pas été généré" "It has been invoiced but the PDF of refund not be generated": "Il a été facturé mais le PDF de remboursement n'a pas été généré",
"Cannot send mail": "Impossible d'envoyer le mail"
} }

View File

@ -2,6 +2,7 @@ const path = require('path');
const smtp = require('./smtp'); const smtp = require('./smtp');
const Component = require('./component'); const Component = require('./component');
const Report = require('./report'); const Report = require('./report');
const UserError = require('vn-loopback/util/user-error');
if (!process.env.OPENSSL_CONF) if (!process.env.OPENSSL_CONF)
process.env.OPENSSL_CONF = '/etc/ssl/'; process.env.OPENSSL_CONF = '/etc/ssl/';
@ -9,7 +10,6 @@ if (!process.env.OPENSSL_CONF)
class Email extends Component { class Email extends Component {
constructor(name, args) { constructor(name, args) {
super(name); super(name);
this.args = args; this.args = args;
} }
@ -88,7 +88,11 @@ class Email extends Component {
force: options.force force: options.force
}; };
return await smtp.send(mailOptions); try {
return await smtp.send(mailOptions);
} catch (error) {
throw new UserError('Cannot send mail');
}
} }
} }