@cloudcommerce/api
Advanced tools
Comparing version 2.10.7 to 2.11.0
@@ -13,2 +13,3 @@ import type { Endpoint, Config, ResponseBody, RequestBody, ErrorBody } from '../types.d'; | ||
config: Config; | ||
url?: string; | ||
response?: Response & { | ||
@@ -20,3 +21,9 @@ data?: ErrorBody; | ||
isTimeout: boolean; | ||
constructor(config: Config, response?: ApiError['response'], msg?: string, isTimeout?: boolean); | ||
constructor({ config, url, response, msg, isTimeout, }: { | ||
config: Config; | ||
url?: string; | ||
response?: ApiError['response']; | ||
msg?: string; | ||
isTimeout?: boolean; | ||
}); | ||
} | ||
@@ -23,0 +30,0 @@ declare const def: { |
@@ -7,3 +7,5 @@ if (!globalThis.__apiCache) { | ||
class ApiError extends Error { | ||
constructor(config, response, msg, isTimeout = false) { | ||
constructor({ | ||
config, url, response, msg, isTimeout = false, | ||
}) { | ||
if (response) { | ||
@@ -16,2 +18,3 @@ super(response.statusText); | ||
} | ||
this.url = url; | ||
this.config = config; | ||
@@ -139,3 +142,9 @@ this.response = response; | ||
} | ||
throw new ApiError(config, response, msg, isTimeout); | ||
throw new ApiError({ | ||
config, | ||
url, | ||
response, | ||
msg, | ||
isTimeout, | ||
}); | ||
} | ||
@@ -171,3 +180,3 @@ clearTimeout(timer); | ||
} | ||
throw new ApiError(config, response); | ||
throw new ApiError({ config, url, response }); | ||
}; | ||
@@ -174,0 +183,0 @@ const get = (endpoint, config) => { |
{ | ||
"name": "@cloudcommerce/api", | ||
"type": "module", | ||
"version": "2.10.7", | ||
"version": "2.11.0", | ||
"description": "E-Com Plus Cloud Commerce APIs client/adapter", | ||
@@ -6,0 +6,0 @@ "main": "lib/api.js", |
Sorry, the diff of this file is not supported yet
157809
6114