@pear-protocol/symmio-client 0.2.39 → 0.2.40

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
@@ -24396,6 +24396,7 @@ var instant_exports = {};
24396
24396
  __export(instant_exports, {
24397
24397
  cancelInstantClose: () => cancelInstantClose,
24398
24398
  createSiweMessage: () => createSiweMessage,
24399
+ getHedgerBaseUrl: () => getHedgerBaseUrl,
24399
24400
  getNonce: () => getNonce,
24400
24401
  getOpenInstantCloses: () => getOpenInstantCloses,
24401
24402
  instantClose: () => instantClose,
@@ -24456,10 +24457,24 @@ async function login(chainId, params) {
24456
24457
  body: JSON.stringify(body)
24457
24458
  });
24458
24459
  if (!response.ok) {
24459
- const errorData = await response.json().catch(() => null);
24460
- throw new Error(
24461
- errorData?.error_message ?? `Login failed: ${response.statusText}`
24462
- );
24460
+ let errorMessage = "";
24461
+ if (typeof response.text === "function") {
24462
+ const rawBody = await response.text().catch(() => "");
24463
+ if (rawBody) {
24464
+ try {
24465
+ const parsed = JSON.parse(rawBody);
24466
+ errorMessage = parsed.error_message ?? parsed.message ?? parsed.detail ?? rawBody;
24467
+ } catch {
24468
+ errorMessage = rawBody;
24469
+ }
24470
+ }
24471
+ }
24472
+ if (!errorMessage && typeof response.json === "function") {
24473
+ const errorData = await response.json().catch(() => null);
24474
+ errorMessage = errorData?.error_message ?? errorData?.message ?? errorData?.detail ?? "";
24475
+ }
24476
+ const reason = errorMessage || response.statusText;
24477
+ throw new Error(reason ? `Login failed: ${reason}` : "Login failed");
24463
24478
  }
24464
24479
  const data = await response.json();
24465
24480
  if (!data.access_token) {