From d84f9e587722431d757dbfbb651c0491e04cb8d1 Mon Sep 17 00:00:00 2001 From: Jan Dvorak Date: Thu, 19 Dec 2024 15:28:34 +0900 Subject: [PATCH] Upgrade applyAsync signature --- lib/utils/client.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/utils/client.js b/lib/utils/client.js index 5d2994a..59fafac 100644 --- a/lib/utils/client.js +++ b/lib/utils/client.js @@ -19,10 +19,12 @@ const applyOptions = { export function callMethod(name, args) { // args is expected to be an array return new Promise((resolve, reject) => { // we're wrapping in a promise to have the same interface for 2.x and 3.x. the callback is also needed in 3.x so that we can suppress the invocation-failed error in ddp.js - Meteor.applyAsync(name, args, applyOptions, (error, result) => { + Meteor.applyAsync(name, args, applyOptions).catch(error => { if (error) { reject(error) - } else { + } + }).then(result => { + if (result) { resolve(result) } });