catch uncontrolled nested promises to avoid several uncaught logs

This commit is contained in:
Nacho Codoñer
2024-03-21 16:41:00 +01:00
parent d08ec8ab0d
commit abb3201f98
2 changed files with 9 additions and 6 deletions

View File

@@ -20,10 +20,11 @@ export const loadAsyncStubHelpers = () => {
queue = queue.finally(() => {
fn(resolve, reject);
return promise.stubPromise;
return promise.stubPromise?.catch(() => {});
});
promise.finally(() => {
promise.catch(() => {}).finally(() => {
queueSize -= 1;
if (queueSize === 0) {
Meteor.connection._maybeMigrate();
@@ -98,9 +99,11 @@ export const loadAsyncStubHelpers = () => {
serverPromiseResolver(applyAsyncPromise.serverPromise);
hasStub = !!applyAsyncPromise.stubPromise;
if (hasStub) {
applyAsyncPromise.stubPromise.finally(() => {
finished = true;
});
applyAsyncPromise.stubPromise
.catch(() => {})
.finally(() => {
finished = true;
});
}
applyAsyncPromise
.then((result) => {

View File

@@ -651,7 +651,7 @@ export class Connection {
if (o.exception) {
throw o.exception;
}
return o.stubReturnValue
return o.stubReturnValue;
});
// this avoids attribute recursion
promise.serverPromise = new Promise((resolve, reject) =>