eugeneware / debowerify

A browserify transform to enable the easy use of bower components in browserify client javascript projects. This can be used in conjunction with deamdify to require AMD components from bower as well.
491 stars 51 forks source link

Print a useful message when debowerify can't read a bower.json file #61

Closed callumlocke closed 9 years ago

callumlocke commented 9 years ago

Currently if there's an empty bower.json somewhere, my watch process just quits with the message SyntaxError: Unexpected end of input.

(Empty bower.json files do happen occasionally, after a bower install gone wrong.)

The problem is there is no indication of which file has a syntax error. If you're not expecting a bower.json to be broken, and you're editing JS files at the time you get the error, you spend a long time looking for bugs in the wrong place...

Please update debowerify so whenever you JSON.parse() a file, you do it in a try/catch block, so you can catch any syntax error and then print out a useful message including the path to the bad JSON file, before exiting.

callumlocke commented 9 years ago

actually I looked at your code and don't think the error is coming from debowerify