title: Google maps search Javascript error not being caught
body: <p>I am using google maps autocomplete service to fetch search results for a query.</p>
  
  <p>The sample code is here.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;html&gt; 
    &lt;head&gt;                                                                            
      &lt;meta charset="UTF-8"&gt;                                                          
      &lt;title&gt;Navigation&lt;/title&gt;                                                       
      &lt;script async defer src="https://maps.googleapis.com/maps/api/js?callback=initMap&amp;libraries=places"&gt;&lt;/script&gt;
    &lt;/head&gt;
    &lt;body&gt;
      &lt;div id="map" class="after-hidden" style="height:100%;width:100%;"&gt;&lt;/div&gt;       
      &lt;script&gt;
      function initMap() {
        try {
          autoCompleteService = new google.maps.places.AutocompleteService();
          autoCompleteService.getQueryPredictions({}, () =&gt; { });
        } catch (e) {
          console.log(e, "The error should be caught here. But it is not.");
        }
      }
      &lt;/script&gt;
    &lt;/body&gt;                                                                           
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>I am including google javscript library in the head which provides a global variable google for me to use. When google javascript library finished loading it calls the initMap function.</p>
  
  <p>The first parameter to getQueryPredictions method expects a key input (i.e the first parameter must be like { input: 'India' } ). But I am not passing that parameter to it. Therefore i am getting this error on the console.</p>
  
  <p><code>Error: Missing parameter. You must specify input.     places_impl.js:10:330</code></p>
  
  <p>Now what I was expecting was the catch block in my function to catch this error. But the error is not being caught. Can someone please explain why this is happening and how do I catch this error. I google 'Javscript errors not caught' etc but none of them were able to explain this situation.</p>