Patches error stack to display correct line numbers. CoffeeScript has built in support for this, but it only works when the script is executed through the
coffee command. If you are running mocha, node-dev, jasmine or any other method, the functionality isn't on.
This is a pretty much straight copy of the original source, except it doesn't compile the source maps until necessary therefore speeding up the initial bootup process.
The package reuses expects you to have
coffee-script already installed in your project.
Please help me spend more time developing and maintaining awesome modules like this by donating!
The absolute best thing to do is to sign up with Gittip if you haven't already and donate just $1 a week. That is roughly a cup of coffee per month. Also, please do donate to many other amazing open source projects!
npm install coffee-errors
To get this to work, you just need to require the module once per run-time, like so.
Whenever an error is thrown, all stack lines in
.coffee files will be fixed to show correct line number. YES!
Error: Hello error at Context.<anonymous> (/coffee-errors/test/coffee-errors.spec.coffee:9:17) at Test.Runnable.run (/coffee-errors/node_modules/mocha/lib/runnable.js:213:32) at Runner.runTest (/coffee-errors/node_modules/mocha/lib/runner.js:351:10) at /coffee-errors/node_modules/mocha/lib/runner.js:397:12 at next (/coffee-errors/node_modules/mocha/lib/runner.js:277:14) at /coffee-errors/node_modules/mocha/lib/runner.js:286:7 at next (/coffee-errors/node_modules/mocha/lib/runner.js:234:23) at Object._onImmediate (/coffee-errors/node_modules/mocha/lib/runner.js:254:5) at processImmediate [as _immediateCallback] (timers.js:317:15)
The MIT License (MIT)
Copyright (c) 2013-2014 Alex Gorbatchev
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.