Last active
          January 30, 2023 15:20 
        
      - 
      
 - 
        
Save rclai/b9331afd2fbabadb0074 to your computer and use it in GitHub Desktop.  
    Flexible example of Meteor.wrapAsync
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | // Thanks @trusktr | |
| var requestSync = Meteor.wrapAsync(function(url, callback) { | |
| request(url, function(error, response, body) { | |
| callback(error, {response: response, body: body}) | |
| }) | |
| }); | |
| var result = requestSync("http://google.com"); | |
| console.log(result.response, result.body); | 
Hi! How can you manage the error?
I believe you would just try/catch?
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
            
Thanks a lot! You saved my day.