baudehlo/node-phantom-simple — pull request #38 by seebees (2014-12-30 15:58:11+00:00)
Title: If the phantom process dies, tell people

There are several cases where the phantom process can die and any pending callbacks will never be notified. This is an unfortunate situation.

* In the poll_func, instead of simply returning in these cases, we call the callback with an error param.
* In the request_queue, if the requests emits an error, we call the callback with the error and do not call the next item in the queue as any operations after this point will be in an undefined state.
* In the callbackOrDummy function, we add a little error handling to the poll_func callback. If the poll_func callback gets an error we pass that error on. In this way, you must pass both poll_func and the original arguments… In case we have a strange race

Finally, I added a simple test.