title: How to use 'throw new CustomError("error_message") inside a callback function ? NodeJS/ES6
body: <p>How can we throw error from a callback in NodeJS/ES6?
  Throwing error synchronously works just fine - </p>
  
  <p>Eg -</p>
  
  <pre><code>if (!email) {
        throw new CustomError("email_missing");
  }
  </code></pre>
  
  <p>But 'throw' gives error when used inside a callback function.
  Eg - </p>
  
  <pre><code>api.getData((err, data) =&gt; {
    if (err) {
      throw new CustomError("api_error");
    } else {
      callback(err, data);
    }
  });
  </code></pre>
  
  <p>The console shows the following error -</p>
  
  <pre><code>server running on port 8080
  
  D:\repo\generator\requestBot.js:50
    throw new CustomError("api_error");
    ^
    [object Object]
  </code></pre>