Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Parser syntax errors should be passed to the callback, not thrown #12

Open
rgrove opened this Issue Feb 18, 2011 · 3 comments

Comments

Projects
None yet
2 participants

rgrove commented Feb 18, 2011

When the parser encounters a syntax error, it currently throws a SyntaxError exception instead of bubbling it up to the render callback like I'd expect. Catching this exception is proving to be a challenge in an Express app. I'd much rather be able to handle it in my callback.

Owner

akdubya commented Feb 25, 2011

Can you gist this or post the code here?

rgrove commented Feb 25, 2011

This will throw a SyntaxError in Node (run it as a file, though; the REPL catches and hides the exception):

var dust    = require('dust'),
    context = dust.makeBase();

dust.renderSource('{<body}no end tag', context, function (err, html) {
    if (err) {
        console.log('I got an error!'); // never gets here
    }
});
Owner

akdubya commented Apr 21, 2011

This should be an easy fix. I'll push it out in the next version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment