SDK v4.3.3
Improvements
The EmailJSResponseStatus model is explicitly exported to detect the error instance.
import emailjs from '@emailjs/browser';
try {
await emailjs.send('YOUR_SERVICE_ID', 'YOUR_TEMPLATE_ID');
console.log('SUCCESS!');
} catch (error) {
if (error instanceof emailjs.EmailJSResponseStatus) {
console.log('EMAILJS FAILED...', error);
return;
}
console.log('ANOTHER ERROR', error);
}