xenomuta/coffee-trace — pull request #4 by jessefulton (2013-12-13 18:51:12+00:00)
Title: add checks to avoid errors when empty/short stack trace

So I'm not sure why this happens, or even how to reproduce, but every now and then I'll get an error like the following:

```
/Users/jesse/Projects/whatever/node_modules/coffee-trace/lib/coffee-trace.coffee:17
coffee_trace = (stack = err.stack.split("\n"))[1].match(/^ +at[^\/]+((?:
^
TypeError: Cannot call method 'match' of undefined
at process. (/Users/jesse/Projects/whatever/node_modules/coffee-trace/lib/coffee-trace.coffee:17:57)
at process.EventEmitter.emit (events.js:117:20)
at process._fatalException (node.js:272:26)
```

Checking to make sure the array index exists before calling `.match` or `.replace` seems to fix the problem...