2016-03-14 19 views
0

這一警告已經拿出,因爲我更新sails.js到0.12.0版本:承諾在處理程序創建,但沒有回來

Warning: a promise was created in a handler but was not returned from it 
at Deferred.toPromise (K/trunk/node_modules/waterline/lib/waterline/query/deferred.js:494:61) 
at Deferred.then (K/trunk/node_modules/waterline/lib/waterline/query/deferred.js:505:15) 

它發生在一個控制器,從模型得到的信息,則需要更新模型中的條目。

ExampleModel.findOne() 
.. 
.then(function(){ 
    ExampleModel.update({id:nid},{amount:newamount}) 
    .then(function (updates){ 
     return.json(updates); 
    } 

我不知道如何解決這個問題?這只是一個警告,但希望解決它。

回答

3

試試這個:

ExampleModel.findOne() 
    .then(function(){ 
    return ExampleModel.update({id:nid},{amount:newamount}) 
     .then(function (updates){ 
      return.json(updates); 
     } 
相關問題