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 trial

JavaScript

Pug Issue

I'm having a problem on error template in this video

extends layout

block content
    h1 = error.message
    h2 = error.status
    h3 = error.stack

When i try this i get stack undefined, so when i try to remove the stack line, the error prints out but the two errors actually show the equals sign. Anyone know where I'm going wrong here?

I'm not sure why---but this worked--for anyone else having this issue

extends layout

block content
    h1= message
    h2= error.status
    pre #{error.stack}

1 Answer

Try removing the whitespace between the element tag and the equal sign.

extends layout

block content
    h1= error.message
    h2= error.status
    pre= error.stack

As seen in your example that worked, when using interpolation you don't follow the syntax of

<element>= <variable>
extends layout

block content
    h1 #{error.message}
    h2 #{error.status}
    pre #{error.stack}