use correct code for Mailchimp "already subscribed" state

This commit is contained in:
klokie 2017-06-16 21:42:51 +02:00
parent afc26c0584
commit 25009baba5

View file

@ -47,7 +47,7 @@ if (settings) {
return {result: 'subscribed', ...subscribe};
} catch (error) {
// if the email is already in the Mailchimp list, no need to throw an error
if (error.message === "214") {
if (error.code === 214) {
return {result: 'already-subscribed'};
}
throw new Error("subscription-failed", error.message);
@ -118,4 +118,4 @@ if (settings) {
}
}
}