Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed REST APIs with Express!
You have completed REST APIs with Express!
Preview
Currently, we have no way to catch errors using async/await. In this video we'll learn how to use Node's try/catch block to catch and handle errors.
This video doesn't have any notes.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
like if something goes wrong with the
server when we try to create a new quote.
0:00
Let's take a look at what
happens if an error occurs now.
0:01
Above my code,
0:04
I'll throw a fake error using
JavaScript's built-in error constructor.
0:05
If we go back to Postman and
try to create a new quote again,
0:19
you can see that our API isn't responding.
0:24
It will just hang indefinitely and
that's not what we want.
0:27
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up