3

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?

Hooked
  • 84,485
  • 43
  • 192
  • 261

1 Answers1

2

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. :)

Elias Dorneles
  • 22,556
  • 11
  • 85
  • 107