linkedin/dustjs — pull request #267 by sethkinast (2013-05-14 22:47:01+00:00)
Title: When exceptions occur in handler functions or helpers, call chunk.setError

If a provided handler or helper throws an exception, dust doesn't handle them gracefully. This makes it hard to quickly debug handlers.

This patch captures errors from helpers and handlers and uses chunk.setError() to ensure that dust passes the error along.

The easiest way to see the difference is to use the test page with the default asynchronous streaming example. Try adding

throw "Error!";

to either the `stream` or `delay` functions, or misspelling `setTimeout` in the `delay` function. In the current dust, you'll just see "Pending..." forever because dust has died and can't go on.

With this patch applied, you'll see the error captured and re-thrown dust-style, so that it's displayed in the error panel below the textbox.