@overmap-ai/core 1.0.49-fix-error-messaging.0 → 1.0.49-fix-error-messaging.2
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/overmap-core.js +27 -16
- package/dist/overmap-core.js.map +1 -1
- package/dist/overmap-core.umd.cjs +27 -16
- package/dist/overmap-core.umd.cjs.map +1 -1
- package/package.json +1 -1
package/dist/overmap-core.js
CHANGED
|
@@ -4547,7 +4547,20 @@ class BaseApiService {
|
|
|
4547
4547
|
}
|
|
4548
4548
|
};
|
|
4549
4549
|
const errorHandler = (error2) => {
|
|
4550
|
-
error2
|
|
4550
|
+
if (error2 instanceof APIError) {
|
|
4551
|
+
error2.options.discard = true;
|
|
4552
|
+
} else {
|
|
4553
|
+
console.error(
|
|
4554
|
+
"Received an unexpected error while processing a request:",
|
|
4555
|
+
error2,
|
|
4556
|
+
"\nConverting error to APIError and discarding."
|
|
4557
|
+
);
|
|
4558
|
+
error2 = new APIError({
|
|
4559
|
+
message: "An error occurred while processing the request.",
|
|
4560
|
+
innerError: error2,
|
|
4561
|
+
discard: true
|
|
4562
|
+
});
|
|
4563
|
+
}
|
|
4551
4564
|
promise.reject(error2);
|
|
4552
4565
|
};
|
|
4553
4566
|
innerPromise.then(successOrUndefinedHandler, errorHandler);
|
|
@@ -5127,24 +5140,22 @@ class AuthService extends BaseApiService {
|
|
|
5127
5140
|
*/
|
|
5128
5141
|
__publicField(this, "_getTokenPair", (credentials, logoutOnFailure = true) => {
|
|
5129
5142
|
const uuid = v4();
|
|
5130
|
-
|
|
5131
|
-
|
|
5132
|
-
|
|
5133
|
-
|
|
5134
|
-
|
|
5135
|
-
|
|
5136
|
-
|
|
5137
|
-
|
|
5138
|
-
|
|
5139
|
-
|
|
5140
|
-
});
|
|
5141
|
-
return [responsePromise.then(parseTokens), uuid];
|
|
5142
|
-
} catch (e) {
|
|
5143
|
+
const responsePromise = this.enqueueRequest({
|
|
5144
|
+
uuid,
|
|
5145
|
+
description: "Get token pair",
|
|
5146
|
+
method: HttpMethod.POST,
|
|
5147
|
+
url: "/api/token/",
|
|
5148
|
+
payload: credentials,
|
|
5149
|
+
isAuthNeeded: false,
|
|
5150
|
+
blockers: [],
|
|
5151
|
+
blocks: []
|
|
5152
|
+
}).then(parseTokens).catch((e) => {
|
|
5143
5153
|
if (logoutOnFailure) {
|
|
5144
5154
|
void this.logout().then();
|
|
5145
5155
|
}
|
|
5146
5156
|
throw e;
|
|
5147
|
-
}
|
|
5157
|
+
});
|
|
5158
|
+
return [responsePromise, uuid];
|
|
5148
5159
|
});
|
|
5149
5160
|
/**
|
|
5150
5161
|
* Takes refresh token and gets a new token pair
|
|
@@ -5205,7 +5216,7 @@ class AuthService extends BaseApiService {
|
|
|
5205
5216
|
timedOut = true;
|
|
5206
5217
|
store.dispatch(markForDeletion(uuid));
|
|
5207
5218
|
store.dispatch(markForDeletion(initialDataUuid));
|
|
5208
|
-
reject(new
|
|
5219
|
+
reject(new APIError({ message: `Request timed out after ${timeout} seconds` }));
|
|
5209
5220
|
}, timeout * 1e3);
|
|
5210
5221
|
});
|
|
5211
5222
|
const successPromise = promise.then((tokens) => {
|