Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

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

Open
rgrove opened this Issue · 3 comments

2 participants

@rgrove

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.

@akdubya
Owner

Can you gist this or post the code here?

@rgrove

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
    }
});
@akdubya
Owner

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
Something went wrong with that request. Please try again.