Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialJohn C
Courses Plus Student 138 PointsHow does express pull the error pug template when passwords don't match. I don't see a route defined for this template.
I have checked the project code and as it says in the title, I just don't understand how the template error.pug gets activated when for instance the user misspells his/her password.
1 Answer
Zack Lee
Courses Plus Student 17,662 Pointswhen the password is incorrect, it creates an error and passes it with next(err), this "next(err)" is then passed along until it reaches the error handler found at the bottom of app.js. there the error pug is rendered with the designated error message defined in the original route where the error was created. so there is no error route that renders the error pug. rather, the route is passed to the error handler in app.js where the error.pug is rendered.
John C
Courses Plus Student 138 PointsJohn C
Courses Plus Student 138 PointsOhh I understand now. Thank you so much!