Skip to content

Commit

Permalink
Prevent destroyed providers from emitting network detection errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
ricmoo committed Aug 15, 2023
1 parent 30d3d6e commit 7d41730
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src.ts/providers/provider-jsonrpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -693,6 +693,7 @@ export abstract class JsonRpcApiProvider extends AbstractProvider {
try {
this.#network = await this._detectNetwork();
} catch (error) {
if (this.destroyed) { break; }
console.log("JsonRpcProvider failed to detect network and cannot start up; retry in 1s (perhaps the URL is wrong or the node is not started)");
this.emit("error", makeError("failed to bootstrap network detection", "NETWORK_ERROR", { event: "initial-network-discovery", info: { error } }));
await stall(1000);
Expand Down

0 comments on commit 7d41730

Please sign in to comment.