Skip to content
Snippets Groups Projects

[JES] Try and examine the error message to see if it's an actual error or not....

Merged Jason Salyers requested to merge jsalyers-rpc-error-check into master
2 files
+ 7
1
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -46,6 +46,12 @@ export function jsonRpc(uri, {method, id, params, fetchMethod=fetch}) {
throw new Error(`Invalid response id: ${ rpcRes.id }`);
}
if (rpcRes.error) {
if (rpcRes.error.code === -32602)
{
//hivemind returns an error when tags aren't found, but it's not really an error
//because the http return code was ok, so just return an empty response instead
return "{\"id\":" + rpcRes.id + ", \"result\":[], \"jsonrpc\":\"2.0\"}";
}
throw new RPCError(rpcRes.error);
}
return rpcRes.result
Loading