In one of my Rails apps, ExecJS is not showing line numbers for coffeescript compilation errors. My compile error message will look like this:
ExecJS::RuntimeError in Referrals#new
Showing ~/MyApp/app/views/layouts/application.html.erb where line #6 raised:
SyntaxError: unexpected IDENTIFIER
(in ~/MyApp/assets/javascripts/utils.js.coffee)
Note that there's no line number for the coffee script source (line #6 is for the erb file).
On another one of my apps, where I'm still getting the line numbers, a syntax error looks like this:
ExecJS::ProgramError in Projects#show
Showing ~/OtherApp/app/views/layouts/application.html.erb where line #17 raised:
Error: Parse error on line 6: Unexpected 'STRING'
(in ~/OtherApp/app/assets/javascripts/projects.js.coffee)
So it seems the difference is that ExecJS::ProgramError
will give me the line numbers, where as ExecJS::RuntimeError
will not.
Anyone have any idea how to get the line numbers back? Why is my app creating RuntimeErrors on coffee asset compilation, while the other is giving ProgramErrors? I've checked Rails and they seem to match.
Note that if I fix the compilation errors, the app runs fine (e.g., the coffee files are actually do get compiled) -- but it'd be nice to have those line numbers point me to the compilation errors!.
EDIT
I realized that whether it's an ExecJS Runtimeerror
or a ProgramError
doesn't seem to matter -- in the first app, there's never a line number given and in the second, there always is.