beardsvibe / buildfox

Minimalistic Ninja generator
MIT License
50 stars 8 forks source link

Improve error message if you write += to non existent variable #138

Closed jimon closed 8 years ago

jimon commented 8 years ago

Now it's just a stack trace :

Traceback (most recent call last):
  File "/usr/local/bin/bf", line 9, in <module>
    load_entry_point('buildfox==0.2.1', 'console_scripts', 'bf')()
  File "/Library/Python/2.7/site-packages/buildfox/__init__.py", line 1977, in main
    engine.load(args.get("in"))
  File "/Library/Python/2.7/site-packages/buildfox/__init__.py", line 511, in load
    parse(self, filename)
  File "/Library/Python/2.7/site-packages/buildfox/__init__.py", line 455, in parse
    parser.parse()
  File "/Library/Python/2.7/site-packages/buildfox/__init__.py", line 70, in parse
    self.parse_line()
  File "/Library/Python/2.7/site-packages/buildfox/__init__.py", line 134, in parse_line
    self.engine.on_assign(obj)
  File "/Library/Python/2.7/site-packages/buildfox/__init__.py", line 880, in on_assign
    value = self.eval_assign_op(value, self.variables.get(name), op)
  File "/Library/Python/2.7/site-packages/buildfox/__init__.py", line 647, in eval_assign_op
    return prev_value + value
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'