Emit an error event when something goes wrong...

more closely mirroring the nodejs http module api.  This is done my assigning an onerror handler to xhr and propagating the event up.