uber-archive / multitransport-jsonrpc

JSON-RPC Client (Node.js & Browser) and Server (Node.js) aim at "natural looking" server and client code.
116 stars 22 forks source link

Properly handle Errors when the server is down #72

Closed dughibot closed 8 years ago

dughibot commented 8 years ago

This is a fix for: https://github.com/uber/multitransport-jsonrpc/issues/73 If the RPC server is down and an http client tries to make a request, the response from the http client is an Error object rather than an object with the field "error." This means that the error doesn't actually get properly returned to the callback.

This could also be fixed by making the http client wrap the error, but I put it into the lib/client.js file to be a bit more general of a fix.

dughibot commented 8 years ago

Th CI failure appears to have been an issue with the npm install on node v0.8.28. Given that it passed on v0.10.40 and v0.12.7 and that I didn't change the package.json, I don't think this is an issue with the code in this PR.

dfellis commented 8 years ago

Oh, hey. I was out and off Github last week. Just noticed this today. Looking now. :)

dfellis commented 8 years ago

Agree with you on this diff. Not sure why Travis failed for Node 0.8. Will pursue that independently.

dfellis commented 8 years ago

Published as 0.9.3