I would like to create a promisify wrapper method, where the callback is customisable method and user can provide, I will send this method as a parameter to the promisify method, it should return me a promise with resolve and reject callbacks.
Here is my sample for creating a wrapper for promisify:
function promisify(callback) {
  var promise1= new Promise(function(resolve,reject){
    callback(resolve);
   // resolve();
  })
  return promise1;
}
function myTimer(resolve) {
  setTimeout(function(){
    console.log('hello');
    resolve();
  },2000);
}
promisify(myTimer).then(function(){
  alert("jello");
})Is this the right approach to call the resolve in the promisify, and how can I catch the error?
 
    