From 86cf69fc958b28cd8060e325e8db240ee2504765 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Orpeli=C3=A8re?= Date: Thu, 4 Feb 2016 00:25:48 +0100 Subject: [PATCH] Fix problem afterError always called --- lib/remote-objects.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/remote-objects.js b/lib/remote-objects.js index a4350704..236ba1dd 100644 --- a/lib/remote-objects.js +++ b/lib/remote-objects.js @@ -677,7 +677,12 @@ RemoteObjects.prototype.invokeMethodInContext = function(ctx, method, cb) { 'Pass the method as ctx.method instead.'); } - self.phases.run(ctx, triggerErrorAndCallBack); + self.phases.run(ctx, testIfErrorAndCallBack); + + function testIfErrorAndCallBack(err) { + if (err) return triggerErrorAndCallBack(err); + cb(); + } function triggerErrorAndCallBack(err) { ctx.error = err;