I'm using cookiecutter to help manage a web template. You can specify a special file hooks/pre_gen_project.py that will run before any of the template commands start. If it fails however, cookiecutter keeps going, even if hooks/pre_gen_project.py throws an exception! A minimal example would simply be:
raise SyntaxError
in this file. Is there a way to halt execution once an error has been raised?
Until recently, cookiecutter ignored errors in the hook scripts. I've submited a fix for this that got merged recently.
So, if you use Cookiecutter >= 1.3.0, the project generation will be canceled when the hook script fails. :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With