@chainflip/rpc 1.8.2 → 1.8.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,13 +9,22 @@ var HttpClient = (_class = class extends _Clientcjs2.default {constructor(...arg
9
9
  __init2() {this.batchDuration = 100}
10
10
  __init3() {this.requestMap = /* @__PURE__ */ new Map()}
11
11
  async send(request) {
12
- const res = await fetch(this.url, {
13
- body: JSON.stringify(request),
14
- method: "POST",
15
- headers: {
16
- "Content-Type": "application/json"
17
- }
18
- });
12
+ let res;
13
+ try {
14
+ res = await fetch(this.url, {
15
+ body: JSON.stringify(request),
16
+ method: "POST",
17
+ headers: {
18
+ "Content-Type": "application/json"
19
+ }
20
+ });
21
+ } catch (error) {
22
+ return request.map((r) => ({
23
+ id: r.id,
24
+ success: false,
25
+ error: new Error("Network error", { cause: error })
26
+ }));
27
+ }
19
28
  if (!res.ok) {
20
29
  return request.map((r) => ({
21
30
  id: r.id,
@@ -9,13 +9,22 @@ var HttpClient = class extends Client {
9
9
  batchDuration = 100;
10
10
  requestMap = /* @__PURE__ */ new Map();
11
11
  async send(request) {
12
- const res = await fetch(this.url, {
13
- body: JSON.stringify(request),
14
- method: "POST",
15
- headers: {
16
- "Content-Type": "application/json"
17
- }
18
- });
12
+ let res;
13
+ try {
14
+ res = await fetch(this.url, {
15
+ body: JSON.stringify(request),
16
+ method: "POST",
17
+ headers: {
18
+ "Content-Type": "application/json"
19
+ }
20
+ });
21
+ } catch (error) {
22
+ return request.map((r) => ({
23
+ id: r.id,
24
+ success: false,
25
+ error: new Error("Network error", { cause: error })
26
+ }));
27
+ }
19
28
  if (!res.ok) {
20
29
  return request.map((r) => ({
21
30
  id: r.id,