@supabase/storage-js 2.99.2 → 2.99.3

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
@@ -260,25 +260,17 @@ const _getErrorMessage = (err) => {
260
260
  * @param namespace - Error namespace ('storage' or 'vectors')
261
261
  */
262
262
  const handleError = async (error, reject, options, namespace) => {
263
- if (error && typeof error === "object" && "status" in error && "ok" in error && typeof error.status === "number") {
263
+ if (error !== null && typeof error === "object" && typeof error.json === "function") {
264
264
  const responseError = error;
265
- const status = responseError.status || 500;
266
- if (typeof responseError.json === "function") responseError.json().then((err) => {
265
+ let status = parseInt(responseError.status, 10);
266
+ if (!Number.isFinite(status)) status = 500;
267
+ responseError.json().then((err) => {
267
268
  const statusCode = (err === null || err === void 0 ? void 0 : err.statusCode) || (err === null || err === void 0 ? void 0 : err.code) || status + "";
268
269
  reject(new StorageApiError(_getErrorMessage(err), status, statusCode, namespace));
269
270
  }).catch(() => {
270
- if (namespace === "vectors") {
271
- const statusCode = status + "";
272
- reject(new StorageApiError(responseError.statusText || `HTTP ${status} error`, status, statusCode, namespace));
273
- } else {
274
- const statusCode = status + "";
275
- reject(new StorageApiError(responseError.statusText || `HTTP ${status} error`, status, statusCode, namespace));
276
- }
277
- });
278
- else {
279
271
  const statusCode = status + "";
280
272
  reject(new StorageApiError(responseError.statusText || `HTTP ${status} error`, status, statusCode, namespace));
281
- }
273
+ });
282
274
  } else reject(new StorageUnknownError(_getErrorMessage(error), error, namespace));
283
275
  };
284
276
  /**
@@ -1365,7 +1357,7 @@ var StorageFileApi = class extends BaseApiClient {
1365
1357
 
1366
1358
  //#endregion
1367
1359
  //#region src/lib/version.ts
1368
- const version = "2.99.2";
1360
+ const version = "2.99.3";
1369
1361
 
1370
1362
  //#endregion
1371
1363
  //#region src/lib/constants.ts