Code Monkey home page Code Monkey logo

Comments (7)

benjaminhoffman avatar benjaminhoffman commented on September 21, 2024 1

lol same. went thru the same thought process and should've stuck w result. going to close this now and merge your PR. may need to make some edits later this weekend but good enough for now.

thanks @steebchen for the contrib! much appreciated.

from gatsby-plugin-mailchimp.

benjaminhoffman avatar benjaminhoffman commented on September 21, 2024

looking into this.

from gatsby-plugin-mailchimp.

benjaminhoffman avatar benjaminhoffman commented on September 21, 2024

we return an object: https://github.com/benjaminhoffman/gatsby-plugin-mailchimp/blob/master/src/index.js#L58

weird it's coming out as an exception. we could change this line: https://github.com/benjaminhoffman/gatsby-plugin-mailchimp/blob/master/src/index.js#L62-L65

to this:

if (!isEmailValid) {
  new Promise((_, reject) => {
      reject({
          status: 'error',
          msg: 'Please enter a valid email address.'
    })
  })
)

thoughts?

that still doesn't explain why it's throwing a UE.

from gatsby-plugin-mailchimp.

benjaminhoffman avatar benjaminhoffman commented on September 21, 2024

@steebchen ^^

from gatsby-plugin-mailchimp.

steebchen avatar steebchen commented on September 21, 2024

Ah, I just realized why this happens. The build file is outdated:

capture

That would explain why it throws.

Now we still need to return a promise, though, because we can't use .then otherwise. However, I suggest to use Promise.resolve, because we can then use .catch for network errors when something failed horribly, and use resolve with { status: 'error' } { result: 'error', msg: '...' } to notify the user did something wrong: #19

from gatsby-plugin-mailchimp.

benjaminhoffman avatar benjaminhoffman commented on September 21, 2024

this sounds like a good strategy. question, do you recommend status instead result?

from gatsby-plugin-mailchimp.

steebchen avatar steebchen commented on September 21, 2024

Personally, I'd prefer status, but I suggest we stick to result to be consistent with mailchimp's responses.

from gatsby-plugin-mailchimp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.