Hi, thanks for your reply, i've edit my code in:

module.exports.run = function(event, context, cb) {
  myclass.queryAsync(...)
 .then(function (results) {
   if (results.field === "test") {
     return cb("error");
   } else {
     return cb(null, "success");
   }
 })
 .catch(function (err) {
   return cb(err)
 });
};
The error is te same.
Best regards


Il giorno giovedì 17 dicembre 2015 05:08:38 UTC+1, Ebrahim Pasbani ha 
scritto:
>
> You shouldn't throw exception in a callback.
> Instead throwing of that exception call 
> cb(error)
>
>
>
> On Thursday, 17 December 2015 04:40:56 UTC+3:30, AndDM wrote:
>>
>> Hi, i've this code:
>>
>> module.exports.run = function(event, context, cb) {
>>   myclass.queryAsync(...)
>>   .then(function (results) {
>>     if (results.field === "test") {
>>       throw "error";
>>     } else {
>>       return cb(null, "success");
>>     }
>>   })
>>   .catch(function (err) {
>>     return cb(err)
>>   });
>> };
>>
>> for promise i'm using bluebirdjs and i've attached this code to a mocha 
>> test. If function give back a success, the test passes without problems. If 
>> the test has errors, the stdout give back: Unhandled rejection null, the 
>> mocha test goes on and then stops with exceeded timeout limit.
>>
>> My mocha test:
>>   before("Description", function(done) {
>>     require('path').run(event.options, {}, function (err, results) {
>>       if (err) {
>>         throw err;
>>       }
>>       done();
>>     });
>>   });
>>   
>>
>> Some suggestions about that?
>> Thanks for your time.
>> Best regards
>>
>

-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/c7ee7cd9-113d-4f72-93e7-c4e1861ab99d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to