@go-avro/avro-js 0.0.79 → 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 +8 -2
- package/dist/client/core/xhr.js +8 -2
- package/dist/types/api/Task.d.ts +1 -0
- package/dist/types/error.d.ts +2 -1
- package/dist/types/error.js +2 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
|
@@ -54,20 +54,26 @@ 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);
|
|
61
65
|
}
|
|
62
66
|
let errorMessage = response.statusText;
|
|
67
|
+
let errorBody;
|
|
63
68
|
try {
|
|
64
69
|
const parsedError = await response.json();
|
|
70
|
+
errorBody = parsedError;
|
|
65
71
|
errorMessage = parsedError.message ?? parsedError.msg ?? errorMessage;
|
|
66
72
|
}
|
|
67
73
|
catch (e) {
|
|
68
74
|
console.error('Ignoring:', e);
|
|
69
75
|
}
|
|
70
|
-
throw new StandardError(response.status, errorMessage);
|
|
76
|
+
throw new StandardError(response.status, errorMessage, errorBody);
|
|
71
77
|
}
|
|
72
78
|
catch (error) {
|
|
73
79
|
if (error instanceof StandardError) {
|
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/types/api/Task.d.ts
CHANGED
|
@@ -40,6 +40,7 @@ declare module '../../types/api/Task' {
|
|
|
40
40
|
bill_mode: 'MONTH' | 'SERVICE' | 'NONE';
|
|
41
41
|
autobill: boolean;
|
|
42
42
|
price: number;
|
|
43
|
+
last_unrouted_reason: 'NOT_DUE' | 'DEPENDENCY_UNMET' | 'MISSING_SKILLS' | 'OVER_CAPACITY' | 'TRAVEL_TIME' | 'LOW_PRIORITY' | 'DID_NOT_FIT' | null;
|
|
43
44
|
services_remaining: number;
|
|
44
45
|
activate_on: number | null;
|
|
45
46
|
expire_on: number | null;
|
package/dist/types/error.d.ts
CHANGED
package/dist/types/error.js
CHANGED
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