MENU

Fun & Interesting

Error Handling in Express

Jan Goebel 40,276 5 years ago
Video Not Working? Fix It Now

🔥More exclusive content: https://productioncoder.com/you-decide-what-we-build-next Twitter: https://twitter.com/_jgoebel Blog: https://productioncoder.com Code: https://github.com/productioncoder/express-error-handling In this video, we cover how do error handling in express and Node.js. We explain how to return expected errors and how to not leak internal details of your application in case of unexpected errors. 00:00 application walk through 01:30 a better way of hard coding HTTP status codes 02:36 defining API errors with status codes 04:19 creating an API error handling middleware 07:14 making use of next in express 08:14 plugging our our api error handling middleware into our router 08:55 making use of our predefined API errors 10:17 testing our error handling 11:03 preventing leaks from unexpected errors

Comment