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