Can't see correct coffee location upon error #1

myok12 opened this Issue Dec 10, 2012 · 9 comments


None yet
3 participants

myok12 commented Dec 10, 2012

Tried my code, and even the provided example, and it always stop on line 0 of the coffee file; the js location is correct. Tried it with coffee 1.3.3 and 1.4.0 -- the same.

The example is:


test = ->
  people =
      first_name: 'john'
      last_name: 'doe'
      first_name: 'mary'
      last_name: 'jane'

  console.log("Welcome", people[p].first_name, people[p].last_name, "!!!") for p in ['john', 'mary', 'josh']

process.nextTick test

And it generates:

Welcome john doe !!!
Welcome mary jane !!!

   ( (
    ) )
 |        |]
  \      /
   `----'  ❛●•・

 CoffeeScript: /Users/204227/mobileweb/
   1: require('coffee-trace')
   3: test = ->

 Javascript: /Users/204227/mobileweb/
   19:     _results = [];
   20:     for (_i = 0, _len = _ref.length; _i < _len; _i++) {
   21:       p = _ref[_i];                                  ⬇
 ✘ 22:       _results.push(console.log("Welcome", people[p].first_name, people[p].last_name, "!!!"));
   23:     }
   24:     return _results;
   25:   };

xenomuta was assigned Dec 11, 2012


xenomuta commented Dec 11, 2012

I am in the process of rewriting the messy and hackish line_finder module.

In the meantime you might want to check Michael Ficarra's CoffeeScriptRedux ...

myok12 commented Dec 14, 2012

It seems that CoffeeScriptRedux is still a work in progress. It complains about many of my files (mainly indentation, incorrectly reported) or even CS features.

Could you also explain what errors are being caught and what can't? I think that one can't catch a "Error: Cannot find module". And it does catch a "TypeError: Cannot read property 'XXX' of undefined", but it doesn't catch a "TypeError: string is not a function", for example. Not sure which cases it covers.

myok12 commented Dec 14, 2012

Also, it seems like I need to have the process.nextTick in place for it to catch errors in the require()ing file, but wasn't sure why.


xenomuta commented Dec 14, 2012

I'm testing the experimental Domain bindings to address these issues. I am rewriting the way I match the .coffee and .js lines without (hopefully) compiling the files. Will soon commit and push when satisfied.

The nextTick() is necessary because coffee-trace hooks on process.on('uncaughtException', ...) which is (off-course) asynchronously assigned to the next tick of the event loop, so exceptions in the current loop ( right after require()ing a missing module for example ) are disregarded.

Please commit your Domain experimental code (even if it's not completed) to a branch so I can contribute.


xenomuta commented Jan 29, 2013

@missinglink: I'll do just that as soon as I return from my "vacations", as I did not push that particular local branch and its trapped in my office's computer.

Sweet, all good, enjoy your "vacations"


xenomuta commented Jan 29, 2013

@missinglink, thanks a big one for your suggestions on @showell's CoffeeScriptLineMatcher code. It worked charms.

@myok12, please, give this one a try.

xenomuta closed this Jan 29, 2013

xenomuta reopened this Jan 29, 2013


xenomuta commented Jan 29, 2013

big oops guys... (embarassing)... trigger happy just pushed untested code...

Sorry about that "blooper". Try now guys...


xenomuta closed this Jan 29, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment