componentjs / component

frontend package manager and build tool for modular web applications
https://github.com/componentjs/guide
MIT License
4.55k stars 305 forks source link

build error when syntax error in file #573

Closed jasonkuhrt closed 10 years ago

jasonkuhrt commented 10 years ago

Given a file e.g. foobar.js, literally containing a syntax error such as:

)

or

+

or

delete

or etc.

causes component build to freak out:

> component build
       build : resolved in 25ms

       error : undefined

with very little explanation about what's going on.

jasonkuhrt commented 10 years ago

A build error would be helpful but only given these conditions:

Neither of the above is currently true.

wryk commented 10 years ago

+1 for doesn't interrupt --watch, it's pretty annoying

chemzqm commented 10 years ago

+1 I suppose when using --watch and the file have syntax error, show the error instead of break down the process.

bmcmahen commented 10 years ago

+1 these can be pretty difficult to debug.

karlbohlmark commented 10 years ago

Yup, I just lost half an hour because of a missing parenthesis. Anybody knows where to add the error handling for this?

karlbohlmark commented 10 years ago

If you end up here, you might want to change https://github.com/component/console.js/blob/master/index.js#L29 to err = err.stack || err; and your life will be a whole lot better.

chemzqm commented 10 years ago

@karlbohlmark works great thanks.

kewah commented 10 years ago

@karlbohlmark you should make a PR

timaschew commented 10 years ago

issue is fixed by using utils.error() instead of utils.fatal() and the the version of https://github.com/componentjs/console.js now checks if there is a err.stack

furthermore if an error occurs, previous generated file(s) will be deleted