MERN Stack Tutorial #13 - Handling Error Responses

preview_player
Показать описание
⭐⭐ Get the full course now (without ads) on the Net Ninja Pro site:

⭐⭐ Get access to all free & PREMIUM courses on Net Ninja Pro:

🥷 Course Files (GitHub):

💻 MongoDB Crash Course:

💻 React Full Courses:

🔥🔥🔥 Other resources:
Рекомендации по теме
Комментарии
Автор

This is my First Time Ever doing backend and frontend sides together, and first time for me to know MERN and using express and mongo.
and I'm just so glad that it was from such a great explanation like this. and I really can't tell you how much new information to me I've learned from you from this tutorial.

this is my first tutorial I watch for you actually, and It was Super Super Super Awesome,
Thank You So Much ❤❤ I wish you all happiness .❤

emanmohammed
Автор

HI, In case if you are facing the error like cannot read *includes* undefined or something. Then add emptyFields in 3:05 line 51 as this res.status(400).json({error: error.message, emptyFields});

Then restart both the backend and frontend server to make it work. It's important to restart the server to see the changes reflected back in your browser. Hope it helps, thanks :)

mangalamkallo
Автор

My code was not working, needed to close the backend and frontend terminal and have it running back.

marioacosta
Автор

Great tutorial, simple to understand. The only thing I would add was the use of zod to validate the form on the place of doing it manually.

DanielMiclos
Автор

Gonna add this beautiful project to my portfolio

ksomeone
Автор

Thanks like always, you are truly a great teacher !

msaters
Автор

Really a Great tutorial for a beginner. Thank you.
But the API calls are just looping infinite times. Could you please provide the suggestion/solution to resolve this ?

deekshithaprabhu
Автор

🤩🤩🤩🤩🤩 super great feature, and so clean with you

mamadouiliassasall
Автор

Hey Jhon where is the update workout feature? Did you forgot to add it or is it coming soon?! By the way love your work brother :)

tarunsharma
Автор

Hey, thanks for the tutorial.
The only problem of this app is when a user enters a string instead of a number for the load and reps input, the app crashes. How do we handle this?
Thanks!

ryannguyen
Автор

Hey Saun where is the update workout feature? Did you forgot to add it or is it coming soon?! By the way love your work brother :)

I really need it

Sifsif__ma
Автор

One issue I am having, if I leave a field empty and submit twice, the app crashes

theyayaa
Автор

Uncaught TypeError: Cannot read properties of undefined (reading 'includes')
at this line ? 'error' : ''} please help

parthkambli
Автор

Awesome playlist.
Doubt: While handling the missing fields, we can simply handle them on frontend, right? Why are we then doing it using backend?

sakshamgarg
Автор

The validation steps are a bit much for 1 error type.
Can you make a series for validations maybe with joi and yup
I've always wondered how the backend and frontend use the same validation

francisnwosu
Автор

how do i do an update for this tutorial

johnagbudumhe
Автор

struggling to do the update part. can someone help me

sutoraika
Автор

*A problem*

Thank you so much for this tutorial.

I have been following through and everything is working well.

But I have a problem with this particular one, Handling Errors.

On trying to check for errors by leaving one or two inputs blank, and then clicking 'Add workout', nothing happens but would get a 400 (Bad request) status in Google developer tools.

I've tried but couldn't fix it.

Please, could you help?

Thanks.

Edit:
I think the solution is on the workoutsForm.js file.
Make sure your emptyFields useState is an array: useState([ ]) and then instead of:

if(! response.ok) {
setError(json.error)

},

replace (!response.ok) with (json.error).

That should solve it if every other thing is okay.

UkomaduChukwudiPaulDesmond
Автор

thanks a lot of the tutorial, just a littlie note here if the field is unique you cant pass the error message, the page just go blank

okol
visit shbcf.ru