开发者

Why does barista/coffeescript not tell you what is wrong when you have an error?

I am trying out coffeescript with barista, and I am not having a good time with it.

For some reason, whenever I make a change to a .coffee file, barista complains that there is a compile error except for the most trivial of cases (like a simple call to 'alert').

When I get these error messages, it doesn't actually tell me what's wrong - it just says that there is a 'V8: JSError'. There are no line numbers. Nothing.

To fix these errors, I CTRL-C the Rails server and restart it... and all is well... but making any change at all to the .coffee file just causes Barista to throw yet another compiler error - and the process repeats. Even if I add correct Cof开发者_运维百科feescript code, it still throws a compiler error. I have no idea why.

How can anyone program like this? I need good feedback or I am totally lost. Most of the time, the .coffee file contains no error because it compiles after I restart the server.

I also prefer fast feedback, or I get impatient. One of the attractions to developing with rails is that everything is pretty immediate. This coffeescript thing though has to be as bad as working in Java.

As much as I hate javascript, at least the feedback is more responsive and I don't have to restart the server.

Did I just set this up wrong? Is this really what it's like to code in coffeescript? If it is... then why is this being forced on everyone in rails 3.1?

I'm just not having a good day today. I'm sorry if this comes off as bad. I've been spending hours with coffeescript and I honestly am not getting very far. Programming without detailed error messages and being forced to restart the server to see my changes take effect reminds me of Java... and that's why I stopped using it in the first place.

:(


What's going on is that when Barista encounters a compile-time error in your CoffeeScript code, it takes that error message and uses it as the JS output. Since that error message is invalid JS, you get a vague error from your browser. If you can think of a better way to do this, you should raise an issue to suggest it.

For now, what you should do is either

  1. View the source of the page, get the address of the JS file, and open it up directly in your browser, or
  2. Use your text editor's “Build” feature (e.g. Cmd+B in TextMate) to show the compiled output, or compilation errors, of the responsible CoffeeScript file, or
  3. Use the barista_growl plugin so that you get a Growl notification when a compilation error occurs.

None of the above is ideal, but browser support for CoffeeScript debugging is coming...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜