Closed cheton closed 9 years ago
If the template engine is not installed, the require() method will throw an error immediately
This behavior looks fine for me. When the script fails to load the template engine, we should stop the process and rewrite the gulpfile. There is no need to handle such an error.
After I upgrade gulp-wrap to v0.10.x, if default template engine lodash
is not installed correctly, there is no error message produced in the console and no output files are generated. It's difficult to troubleshoot because there is no error message.
Once I downgrade to v0.9.x, I'm able to see the error message and is aware of what is missing.
I reproduced the problem and found a better solution.
I'll fix it soon. Thanks for reporting.
Fixed in v0.11.0.
The solution looks good to me. Thanks for your prompt support.
Some template render methods in the consolidate library were implemented like this:
The require() method is not wrapped in the try-catch block. If the template engine is not installed, the require() method will throw an error immediately, and there is no chance to catch errors in render's
fn
callback.I suggest adding a try-catch block to wrap consolidate's render method to handle exceptions, and provide an example of error handling in the documentation as the following: