@niledatabase/server 4.0.0-alpha.19 → 4.0.0-alpha.20

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
@@ -1072,13 +1072,9 @@ async function _fetch(config, path, opts) {
1072
1072
  if (response?.status === 405) {
1073
1073
  return new ResponseError("Method not allowed", { status: 405 });
1074
1074
  }
1075
- let res;
1076
1075
  const errorHandler = typeof response?.clone === "function" ? response.clone() : null;
1077
1076
  let msg = "";
1078
- try {
1079
- res = await response?.json().catch(() => {
1080
- });
1081
- } catch (e) {
1077
+ const res = await response?.json().catch(async (e) => {
1082
1078
  if (errorHandler) {
1083
1079
  msg = await errorHandler.text();
1084
1080
  if (msg) {
@@ -1091,7 +1087,8 @@ async function _fetch(config, path, opts) {
1091
1087
  if (!msg) {
1092
1088
  error("[fetch][response]", { e });
1093
1089
  }
1094
- }
1090
+ return e;
1091
+ });
1095
1092
  if (msg) {
1096
1093
  return new ResponseError(msg, { status: errorHandler?.status });
1097
1094
  }