ScriptS
Reactiflux4y ago
7 replies
Script

✅ – Script – 17-21 Nov 20

createUser api function returns a 500 internal server error but the catch block does not catch the error
I had to add a catch block after the
.then
method for it to catch that error
whats the reason for this?
const submitProfile = async () => {
    try {
      createUser({ ...data, user_image: url.secure_url })
        .then((res) => {
          if (res) {
           console.log(res)
        })
    } catch (err) {
      console.error("THE ERR", err);
    }
  };
Was this page helpful?