From 3132554ea093de4a9d986fdfe24332da2afd5ce6 Mon Sep 17 00:00:00 2001 From: italo jose Date: Tue, 15 Jul 2025 15:08:46 -0300 Subject: [PATCH] Improve error handling in MongoConnection by checking for QueryError instances --- packages/mongo/mongo_connection.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/mongo/mongo_connection.js b/packages/mongo/mongo_connection.js index 36f8b0721f..5879d811c4 100644 --- a/packages/mongo/mongo_connection.js +++ b/packages/mongo/mongo_connection.js @@ -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;