@supabase/postgrest-js 2.107.0-beta.1 → 2.107.0-canary.1

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.cjs CHANGED
@@ -351,7 +351,18 @@ var PostgrestBuilder = class {
351
351
  const body = await res.text();
352
352
  if (body === "") {} else if (_this2.headers.get("Accept") === "text/csv") data = body;
353
353
  else if (_this2.headers.get("Accept") && ((_this$headers$get = _this2.headers.get("Accept")) === null || _this$headers$get === void 0 ? void 0 : _this$headers$get.includes("application/vnd.pgrst.plan+text"))) data = body;
354
- else data = JSON.parse(body);
354
+ else try {
355
+ data = JSON.parse(body);
356
+ } catch (_unused) {
357
+ error = { message: body };
358
+ data = null;
359
+ if (_this2.shouldThrowOnError) throw new PostgrestError({
360
+ message: body,
361
+ details: "",
362
+ hint: "",
363
+ code: ""
364
+ });
365
+ }
355
366
  }
356
367
  const countHeader = (_this$headers$get2 = _this2.headers.get("Prefer")) === null || _this$headers$get2 === void 0 ? void 0 : _this$headers$get2.match(/count=(exact|planned|estimated)/);
357
368
  const contentRange = (_res$headers$get2 = res.headers.get("content-range")) === null || _res$headers$get2 === void 0 ? void 0 : _res$headers$get2.split("/");
@@ -379,7 +390,7 @@ var PostgrestBuilder = class {
379
390
  status = 200;
380
391
  statusText = "OK";
381
392
  }
382
- } catch (_unused) {
393
+ } catch (_unused2) {
383
394
  if (res.status === 404 && body === "") {
384
395
  status = 204;
385
396
  statusText = "No Content";