ForbesLindesay / browserify-middleware

express middleware for browserify, done right
http://browserify.org
MIT License
381 stars 66 forks source link

Should show error messages, not crash node.js #2

Closed al6x closed 11 years ago

al6x commented 11 years ago

Currently if there's syntax error in file node.js will crash with error messages in console.

Maybe it would be better (at least in development) to show error messages in console and in http request for js file, but not crash the server.

ForbesLindesay commented 11 years ago

It shouldn't crash (and doesn't for me). The correct behavior is to serve a 500 server error for the file, and log the actual error message to the console. How are you using it, and what output are you getting?

ForbesLindesay commented 11 years ago

Ah, it does now. It should be fixed by https://github.com/substack/node-browserify/pull/375 which leads to really nice syntax errors like:

C:\GitHub\browserify-middleware\example\client\syntax-error.js:1
foo(
    ^
ParseError: Unexpected end of input
al6x commented 11 years ago

Thanks for your help and sorry for delay with providing details about the problem. I use node for my free-time projects and usually can work with it in on weekends only :).

ForbesLindesay commented 11 years ago

No worries, thanks for the initial report. Hopefully the fix will get merged soon. If not, it can be worked around.

ForbesLindesay commented 11 years ago

This is fixed in 1.7.1 I'd like to leave this issue open as a reminder to remove the hack once @substack merges the proper fix.

ForbesLindesay commented 11 years ago

I'm still patching https://github.com/substack/node-syntax-error/pull/1 but https://github.com/substack/node-browserify/issues/375 is now merged so I'm closing this issue.

al6x commented 11 years ago

If there's an error in transformer (in my case coffeeify) it still crashes, and, what's worse there's no information about the problem - so it's very hard to locate problem, more details https://github.com/substack/coffeeify/pull/10