@go-avro/avro-js 0.0.80 → 0.0.81
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/client/core/fetch.js +5 -1
- package/dist/client/core/xhr.js +8 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
|
@@ -54,7 +54,11 @@ AvroQueryClient.prototype._fetch = async function (method, path, body, cancelTok
|
|
|
54
54
|
await this.config.authManager.refreshTokens();
|
|
55
55
|
return this._fetch(method, path, body, cancelToken, headers, isIdempotent, 1);
|
|
56
56
|
}
|
|
57
|
-
|
|
57
|
+
const isClientError = response.status >= 400 &&
|
|
58
|
+
response.status < 500 &&
|
|
59
|
+
response.status !== 408 &&
|
|
60
|
+
response.status !== 429;
|
|
61
|
+
if (!isClientError && retryCount < this.config.maxRetries) {
|
|
58
62
|
const delay = this.getDelay(this.config.retryStrategy, retryCount);
|
|
59
63
|
await this.sleep(delay);
|
|
60
64
|
return this._fetch(method, path, body, cancelToken, headers, isIdempotent, retryCount + 1);
|
package/dist/client/core/xhr.js
CHANGED
|
@@ -51,14 +51,16 @@ AvroQueryClient.prototype._xhr = async function (method, path, body, cancelToken
|
|
|
51
51
|
}
|
|
52
52
|
else {
|
|
53
53
|
let msg = xhr.responseText || xhr.statusText;
|
|
54
|
+
let errorBody;
|
|
54
55
|
try {
|
|
55
56
|
const parsed = JSON.parse(xhr.responseText);
|
|
57
|
+
errorBody = parsed;
|
|
56
58
|
msg = parsed.message ?? parsed.msg ?? msg;
|
|
57
59
|
}
|
|
58
60
|
catch (e) {
|
|
59
61
|
console.error('Ignoring:', e);
|
|
60
62
|
}
|
|
61
|
-
reject(new StandardError(xhr.status, msg));
|
|
63
|
+
reject(new StandardError(xhr.status, msg, errorBody));
|
|
62
64
|
}
|
|
63
65
|
};
|
|
64
66
|
xhr.onerror = () => reject(new StandardError(0, 'Network Error'));
|
|
@@ -103,7 +105,11 @@ AvroQueryClient.prototype._xhr = async function (method, path, body, cancelToken
|
|
|
103
105
|
throw new StandardError(401, 'Unauthorized (refresh failed)');
|
|
104
106
|
}
|
|
105
107
|
}
|
|
106
|
-
|
|
108
|
+
const isClientError = error.status >= 400 &&
|
|
109
|
+
error.status < 500 &&
|
|
110
|
+
error.status !== 408 &&
|
|
111
|
+
error.status !== 429;
|
|
112
|
+
if (error.status === 401 || isClientError || attempt >= maxRetries) {
|
|
107
113
|
console.error('Not retrying request, throwing error.');
|
|
108
114
|
throw error;
|
|
109
115
|
}
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const AVRO_JS_VERSION = "0.0.
|
|
1
|
+
export declare const AVRO_JS_VERSION = "0.0.81";
|
package/dist/version.js
CHANGED