@supabase/storage-js 3.0.0-next.17 → 3.0.0-next.18

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
@@ -285,8 +285,18 @@ const isValidBucketName = (bucketName) => {
285
285
  * @returns Human-readable error message
286
286
  */
287
287
  const _getErrorMessage = (err) => {
288
- var _err$error;
289
- return err.msg || err.message || err.error_description || (typeof err.error === "string" ? err.error : (_err$error = err.error) === null || _err$error === void 0 ? void 0 : _err$error.message) || JSON.stringify(err);
288
+ if (typeof err === "object" && err !== null) {
289
+ const e = err;
290
+ if (typeof e.msg === "string") return e.msg;
291
+ if (typeof e.message === "string") return e.message;
292
+ if (typeof e.error_description === "string") return e.error_description;
293
+ if (typeof e.error === "string") return e.error;
294
+ if (typeof e.error === "object" && e.error !== null) {
295
+ const nested = e.error;
296
+ if (typeof nested.message === "string") return nested.message;
297
+ }
298
+ }
299
+ return JSON.stringify(err);
290
300
  };
291
301
  /**
292
302
  * Handles fetch errors and converts them to Storage error types
@@ -296,9 +306,9 @@ const _getErrorMessage = (err) => {
296
306
  * @param namespace - Error namespace ('storage' or 'vectors')
297
307
  */
298
308
  const handleError = async (error, reject, options, namespace) => {
299
- if (error !== null && typeof error === "object" && typeof error.json === "function") {
309
+ if (error !== null && typeof error === "object" && "json" in error && typeof error.json === "function") {
300
310
  const responseError = error;
301
- let status = parseInt(responseError.status, 10);
311
+ let status = parseInt(String(responseError.status), 10);
302
312
  if (!Number.isFinite(status)) status = 500;
303
313
  responseError.json().then((err) => {
304
314
  const statusCode = (err === null || err === void 0 ? void 0 : err.statusCode) || (err === null || err === void 0 ? void 0 : err.code) || status + "";
@@ -1490,7 +1500,7 @@ var StorageFileApi = class extends BaseApiClient {
1490
1500
 
1491
1501
  //#endregion
1492
1502
  //#region src/lib/version.ts
1493
- const version = "3.0.0-next.17";
1503
+ const version = "3.0.0-next.18";
1494
1504
 
1495
1505
  //#endregion
1496
1506
  //#region src/lib/constants.ts