1
我在web應用程序中使用Meteor和angularJS 2。請看下面的出版物功能。流星發佈錯誤檢測
Meteor.publish('abc', function() {
// For throwing the meteor error according to the condition
if(!this.userId) throw new Meteor.Error(403,'UnAuthorized error');
// Returning the collection.
return collection.find();
});
現在認購的同時從angularjs2上述出版物中,我使用下面的代碼: -
//瓦爾聲明
this.meteorSubscription = MeteorObservable.subscribe("abc").subscribe(() => {
// Here subscribe data ready, so I called to other method.
});
的問題是這裏要說的是,我怎麼能趕上發佈功能錯誤
'拋出新的Meteor.Error(403,'未授權錯誤')'
好的謝謝。但我如何跟蹤錯誤?我已閱讀onReady和onStop函數。當我在subscribe()中調用任何functin時,onReady成功調用。 – Shubham
我的答案工作?這個問題出現在發佈中,所以在拋出錯誤之前添加一個'console.log(this.userId)'。 – mutdmour
不,發佈功能沒有問題。假設有任何錯誤發生,我想拋出該錯誤。而不是如何在訂閱功能中捕獲客戶端的錯誤。 – Shubham