From b5a2f137580a451ebcb09bad41338ca7ac59e8b6 Mon Sep 17 00:00:00 2001 From: denihs Date: Thu, 22 Sep 2022 17:25:26 -0400 Subject: [PATCH] - throwing error instead of just warning when calling Meteor.call with async methods --- packages/ddp-client/common/livedata_connection.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/ddp-client/common/livedata_connection.js b/packages/ddp-client/common/livedata_connection.js index 06149a70f9..7f65810f52 100644 --- a/packages/ddp-client/common/livedata_connection.js +++ b/packages/ddp-client/common/livedata_connection.js @@ -546,7 +546,7 @@ export class Connection { */ call(name /* .. [arguments] .. callback */) { if (this.isAsyncCall(name)) { - console.warn( + throw new Error( "You should use Meteor.callAsync() when calling async Methods! If you don't call the proper function and don't 'await' or use .then() on its return, some unexpected behaviors may appear." ); } @@ -571,14 +571,14 @@ export class Connection { */ async callAsync(name /* .. [arguments] .. callback */) { if (!this.isAsyncCall(name)) { - console.warn( + throw new Error( "You should use Meteor.call() when calling sync Methods! If you don't call the proper function, some unexpected behaviors may appear." ); } const args = slice.call(arguments, 1); if (args.length && typeof args[args.length - 1] === 'function') { - console.warn( + throw new Error( "Meteor.callAsync() does not accept a callback. You should 'await' the result, or use .then()." ); }