Merge pull request #1651 from Enliven-se/vulcan-newsletter-mailchimp-error-handling

use correct code for Mailchimp "already subscribed" state
This commit is contained in:
Sacha Greif 2017-06-19 08:39:32 +09:00 committed by GitHub
commit 5f95749f17

View file

@ -47,7 +47,7 @@ if (settings) {
return {result: 'subscribed', ...subscribe}; return {result: 'subscribed', ...subscribe};
} catch (error) { } catch (error) {
// if the email is already in the Mailchimp list, no need to throw an 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'}; return {result: 'already-subscribed'};
} }
throw new Error("subscription-failed", error.message); throw new Error("subscription-failed", error.message);