Handling MS errors with Front-end API Answered

Post author
Abdelhalim WithDev

How can I use the errors from Memberstack if I am handling the signup using Front-End API?

Comments

4 comments

  • Comment author
    Raquel Lopez

    You can use try catch blocks to handle errors using Javascript like this https://javascript.info/try-catch

    Keep in mind that you can ask chatGPT to ask about JS technical questions and help you out with small scripts

    0
  • Comment author
    Abdelhalim WithDev

    Raquel Lopez Thanks Raquel, I meant to display the same error elements that are displayed if you are using custom attributes. I will have to put some code inside the "catch" to display the error prompt I guess. now I am just alerting but it doesn't seem professional.

    but, one trick will be to have one element for error prompt with a dummy text block and I pass the message string to replace the dummy text. this will be a dynamic error messaging I guess.

    0
  • Comment author
    Raquel Lopez

    Yes, like you said. Inside the catch you handle the logic you prefer, for example put error.message inside a dom element like a toast or an error alert component

    0
  • Comment author
    Abdelhalim WithDev

    Yes thanks for your help 🙏

    0

Please sign in to leave a comment.