@mattrglobal/verifier-sdk-web 1.1.1-unstable.171 → 1.1.1-unstable.173

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.
@@ -1560,10 +1560,29 @@
1560
1560
  const response = await fetch(input, Object.assign(Object.assign({}, init), {
1561
1561
  headers: headers
1562
1562
  }));
1563
+ const defaultHttpErrorMessage = `HTTP error, status = ${response.status}`;
1564
+ if (response.status >= 400 && response.status < 500) {
1565
+ try {
1566
+ const errorBody = await response.json();
1567
+ if (typeof (errorBody === null || errorBody === void 0 ? void 0 : errorBody.message) === "string") {
1568
+ return err({
1569
+ type: SafeFetchErrorType.HttpError,
1570
+ message: errorBody.message,
1571
+ status: response.status
1572
+ });
1573
+ }
1574
+ } catch (_a) {
1575
+ return err({
1576
+ type: SafeFetchErrorType.HttpError,
1577
+ message: defaultHttpErrorMessage,
1578
+ status: response.status
1579
+ });
1580
+ }
1581
+ }
1563
1582
  if (response.status > 299 || response.status < 200) {
1564
1583
  return err({
1565
1584
  type: SafeFetchErrorType.HttpError,
1566
- message: `HTTP error, status = ${response.status}`,
1585
+ message: defaultHttpErrorMessage,
1567
1586
  status: response.status
1568
1587
  });
1569
1588
  }