Parser syntax errors should be passed to the callback, not thrown
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 2.9k
- Forks
- 461
- PR merge metrics
- No merged PRs in 30d
Description
Originally submitted as akdubya/dustjs#12:
> 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.
>
> This will throw a SyntaxError in Node (run it as a file, though; the REPL catches and hides the exception):
>
> ``` js
> var dust = require('dust'),
> context = dust.makeBase();
>
> dust.renderSource('{ if (err) {
> console.log('I got an error!'); // never gets here
> }
> });
> ```
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the supplied Node example and tracing the dust.renderSource callback and parser error path. Confirm the syntax error currently escapes as a throw, then verify that the render callback receives the error instead and that the example logs “I got an error!”.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100