Improve error handling in MongoConnection by checking for QueryError instances

This commit is contained in:
italo jose
2025-07-15 15:08:46 -03:00
committed by Italo José
parent dae8058c4c
commit 3132554ea0

View File

@@ -1,5 +1,6 @@
import { Meteor } from 'meteor/meteor';
import { CLIENT_ONLY_METHODS, getAsyncMethodName } from 'meteor/minimongo/constants';
import { QueryError } from 'meteor/minimongo/common';
import path from 'path';
import { AsynchronousCursor } from './asynchronous_cursor';
import { Cursor } from './cursor';
@@ -886,7 +887,7 @@ Object.assign(MongoConnection.prototype, {
} catch (e) {
// XXX make all compilation errors MinimongoError or something
// so that this doesn't ignore unrelated exceptions
if (e.name === 'QueryError') {
if (Meteor.isServer && e instanceof QueryError) {
throw e;
}
return false;