dustjs icon indicating copy to clipboard operation
dustjs copied to clipboard

Thrown exception instead of returning error

Open Sembiance opened this issue 8 years ago • 0 comments

The following code throws an uncaught exception:

require("dustjs-linkedin").renderSource("{T}{/T}", {}, function(e, r) { });

Shouldn't dust be catching this exception and passing it into the callback as the first parameter as an error?

/home/sembiance/tmp/dustjs_error/node_modules/dustjs-linkedin/lib/compiler.js:34
      throw new SyntaxError(err.message + ' At line : ' + err.line + ', column : ' + err.column);
      ^

SyntaxError: Expected buffer, comment, end of input, partial, raw, reference, section or special but "{" found. At line : 1, column : 4
    at Object.compiler.compile (/home/sembiance/tmp/dustjs_error/node_modules/dustjs-linkedin/lib/compiler.js:34:13)
    at Object.renderSource (/home/sembiance/tmp/dustjs_error/node_modules/dustjs-linkedin/lib/compiler.js:440:37)
    at Object.<anonymous> (/home/sembiance/tmp/dustjs_error/test.js:1:90)
    at Module._compile (module.js:569:30)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:503:32)
    at tryModuleLoad (module.js:466:12)
    at Function.Module._load (module.js:458:3)
    at Function.Module.runMain (module.js:605:10)
    at startup (bootstrap_node.js:158:16)

Sembiance avatar Aug 16 '17 12:08 Sembiance