Closed raphaelbernhart closed 2 years ago
The send function actually does error handling. If a request fails it will turn it into an Error
and throw it. See https://github.com/dword-design/nuxt-mail/blob/master/src/plugin.js. Anything missing?
Thanks for the answer :)
But when I try to catch the error with
try {
this.$mail.send()
} catch(err) {
console.log(err)
}
The error just gets logged to the console and I can't catch it in the try block.
I think axios catches it and throws the mail error. So you can't catch the error yourself in the highest scope (this.$mail.send()).
I'm currently not home but when I am I will send you a link to a example code. :)
You have to add await
to the function call, otherwise the error will be thrown outside the try-catch block 😃
Yes, I cannot believe I missed that^^ Thanks for the help tho :)
Hi I really like the project but there is one problem. How to give the user feedback when the mail doesn't get sent.
I mean for some sites this is really a critical point of contact. When a potential client is reaching out to a company and the mail doesn't get sent but the client gets the feedback 'mail sent' the client maybe thinks that the company just isn't responding (for any reason).
But as a developer you aren't able to catch the error from
this.$mail.send
.Is there something I don't see? Thanks :)