cacheman icon indicating copy to clipboard operation
cacheman copied to clipboard

Issue return promise from get

Open ashwanikumar04 opened this issue 9 years ago • 1 comments

Hello: I am using callback version of get

return new Promise(resole,reject)
{
cache.get('foo', function (err, value) {
 if(err)
{
reject(err);
} 
else
{
 resolve(value)
}
});
}

But it gives BlueBird warning Warning: a promise was created in a handler but none were returned from it here.

Then I tried the get with promise

function(){
return cache.get('foo')
}

Here I get then() is not defined. I am not sure what am I doing wrong here. Can you please help me in this. Thanks, Ashwani

ashwanikumar04 avatar Feb 09 '16 10:02 ashwanikumar04

Hey there @ashwanikumar04 -

If your post I see that you spelled 'resolve' incorrectly (as 'resole') in your promise constructor. Changing this should solve your issue.

Another option would be to use the libraries built-in promise syntax w/ .then().

niczak avatar Oct 28 '16 18:10 niczak