Expose provider errors & .stats on API (#4878)

* Expose provider errors & .stats on API

* Expose WS errors
This commit is contained in:
Jaco
2022-05-31 10:24:17 +03:00
committed by GitHub
parent a7a5a409d8
commit e7beb2d46f
5 changed files with 25 additions and 2 deletions
+2 -1
View File
@@ -56,7 +56,7 @@ export class HttpProvider implements ProviderInterface {
this.#headers = headers;
this.#stats = {
active: { requests: 0, subscriptions: 0 },
total: { bytesRecv: 0, bytesSent: 0, cached: 0, requests: 0, subscriptions: 0, timeout: 0 }
total: { bytesRecv: 0, bytesSent: 0, cached: 0, errors: 0, requests: 0, subscriptions: 0, timeout: 0 }
};
}
@@ -169,6 +169,7 @@ export class HttpProvider implements ProviderInterface {
return decoded;
} catch (e) {
this.#stats.active.requests--;
this.#stats.total.errors++;
throw e;
}