Passing the xhr object along with the error event

Fixes #17