Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More informative Dust.js errors #150

Closed
abovedave opened this issue Apr 11, 2017 · 2 comments
Closed

More informative Dust.js errors #150

abovedave opened this issue Apr 11, 2017 · 2 comments

Comments

@abovedave
Copy link
Contributor

abovedave commented Apr 11, 2017

If you have a syntax error with Dust.js it tells you which line and col, but not the file where the error is located in the workspace. Example:

/workspace/pages/index.dust

{>"partials/header" /}

{#posts.results}
    {>"partials/post" /}
{/foobar} <<<<<<<<<<<<<<<<<<<<<< Error here

{>"partials/pagination" 
    currentPage=posts.metadata.page
    totalPages=posts.metadata.totalPages
/}

{>"partials/footer" /}
[2017-04-11 11:48:10.409] [LOG]   SyntaxError: Expected end tag for posts.results but it was not found. At line : 5, column : 10
    at Object.compiler.compile (/Users/Dave/Repos/web/node_modules/dustjs-linkedin/lib/compiler.js:34:13)
    at Object.Dust.dust.onLoad (/Users/Dave/Repos/web/dadi/lib/dust/index.js:31:25)
    at /Users/Dave/Repos/web/node_modules/dustjs-linkedin/lib/dust.js:180:18
    at Chunk.map (/Users/Dave/Repos/web/node_modules/dustjs-linkedin/lib/dust.js:722:7)
    at load (/Users/Dave/Repos/web/node_modules/dustjs-linkedin/lib/dust.js:154:22)
    at Object.dust.render (/Users/Dave/Repos/web/node_modules/dustjs-linkedin/lib/dust.js:97:7)
    at Dust.render (/Users/Dave/Repos/web/dadi/lib/dust/index.js:128:8)
    at View.render (/Users/Dave/Repos/web/dadi/lib/view/index.js:36:10)
    at loadData (/Users/Dave/Repos/web/dadi/lib/controller/index.js:206:10)
    at /Users/Dave/Repos/web/dadi/lib/controller/index.js:387:7
    at /Users/Dave/Repos/web/node_modules/async/lib/async.js:52:16
    at Immediate.<anonymous> (/Users/Dave/Repos/web/node_modules/async/lib/async.js:1206:34)
    at runCallback (timers.js:651:20)
    at tryOnImmediate (timers.js:624:5)
    at processImmediate [as _immediateCallback] (timers.js:596:5)
@abovedave
Copy link
Contributor Author

screen shot 2017-04-12 at 20 10 44

@abovedave
Copy link
Contributor Author

abovedave commented Apr 12, 2017

I noticed incidentally, the dust.onLoad function we're attaching our callback errors to (here) is designed to pass-back a string only when combined with dust's own ERROR flag, so although it's logging to our system correctly dust's log reports:

[DUST:ERROR] Rendering failed with error `[object Object]`

Not sure if this matters and if it would require a more comprehensive rework.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant