Skip to content

Commit

Permalink
Fix stray promises when a node returns invalid results (#4118).
Browse files Browse the repository at this point in the history
  • Loading branch information
ricmoo committed Jun 6, 2023
1 parent f37a52d commit 3c1bad2
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src.ts/providers/provider-jsonrpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,12 @@ export abstract class JsonRpcApiProvider extends AbstractProvider {

// No result; the node failed us in unexpected ways
if (resp == null) {
return reject(makeError("no response from server", "BAD_DATA", { value: result, info: { payload } }));
const error = makeError("missing response for request", "BAD_DATA", {
value: result, info: { payload }
});
this.emit("error", error);
reject(error);
continue;
}

// The response is an error
Expand Down

0 comments on commit 3c1bad2

Please sign in to comment.