cacheman
cacheman copied to clipboard
Issue return promise from get
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
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().