@milaboratories/pl-drivers 1.5.14 → 1.5.16

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.
package/dist/index.mjs CHANGED
@@ -834,17 +834,22 @@ class Gt {
834
834
  a
835
835
  ), c = await Vt(o, i.chunkStart, i.chunkEnd);
836
836
  await Jt(o, n);
837
- const {
838
- body: l,
839
- statusCode: p,
840
- headers: J
841
- } = await Ne(i.uploadUrl, {
842
- dispatcher: this.httpClient,
843
- body: c,
844
- headers: We(i.headers),
845
- method: i.method.toUpperCase()
846
- }), nt = await l.text();
847
- Zt(p, nt, J, i), await this.grpcUpdateProgress({ id: e, type: t }, i.chunkEnd - i.chunkStart, a);
837
+ try {
838
+ const {
839
+ body: l,
840
+ statusCode: p,
841
+ headers: J
842
+ } = await Ne(i.uploadUrl, {
843
+ dispatcher: this.httpClient,
844
+ body: c,
845
+ headers: We(i.headers),
846
+ method: i.method.toUpperCase()
847
+ }), nt = await l.text();
848
+ Zt(p, nt, J, i);
849
+ } catch (l) {
850
+ throw new Error(`partUpload: error ${JSON.stringify(l)} happened while trying to do part upload to the url ${i.uploadUrl}, headers: ${JSON.stringify(i.headers)}`);
851
+ }
852
+ await this.grpcUpdateProgress({ id: e, type: t }, i.chunkEnd - i.chunkStart, a);
848
853
  }
849
854
  async finalize(e, t) {
850
855
  return await this.grpcFinalize(e, t);
@@ -886,9 +891,9 @@ async function Vt(s, e, t) {
886
891
  const n = Number(t - e), r = Number(e), a = Buffer.alloc(n), i = await qt(o, a, n, r);
887
892
  return a.subarray(0, i);
888
893
  } catch (n) {
889
- throw n.code == "ENOENT" ? new xe(`there is no file ${s} for uploading`) : n;
894
+ throw n && typeof n == "object" && "code" in n && n.code == "ENOENT" ? new xe(`there is no file ${s} for uploading`) : n;
890
895
  } finally {
891
- o == null || o.close();
896
+ await (o == null ? void 0 : o.close());
892
897
  }
893
898
  }
894
899
  async function qt(s, e, t, o) {
@@ -914,7 +919,7 @@ async function Jt(s, e) {
914
919
  function Zt(s, e, t, o) {
915
920
  if (s != 200)
916
921
  throw new jt(
917
- `response is not ok, status code: ${s}, body: ${e}, headers: ${t}, url: ${o.uploadUrl}`
922
+ `response is not ok, status code: ${s}, body: ${e}, headers: ${JSON.stringify(t)}, url: ${o.uploadUrl}`
918
923
  );
919
924
  }
920
925
  class Qt extends g {
@@ -1522,7 +1527,7 @@ class ho {
1522
1527
  );
1523
1528
  yield* c;
1524
1529
  } catch (c) {
1525
- throw this.logger.warn("Failed to get realtime status" + c), c;
1530
+ throw this.logger.warn("Failed to get realtime status" + String(c)), c;
1526
1531
  }
1527
1532
  }
1528
1533
  }