title: Why is my http library's error handler catching *all* runtime errors in the app?
body: <p>I'm building a prototype app using React Native 0.39 that requests some data from a remote source. To make the request, I use <a href="https://www.npmjs.com/package/react-native-axios" rel="nofollow noreferrer">Axios.</a></p>
  
  <p>The call seems pretty straightforward. In a component named <code>TownsList.js</code>, I do</p>
  
  <pre><code>class TownsList extends Component {
  
    constructor(props) {
      super(props);
      this.state = {towns: []};
    }
  
    componentDidMount() {
  
      let url = "(SOME URL HERE)";
  
      axios.get(url)
           .then(function(response) {
             // Do stuff witt the successful result
           })
           .catch(function (error) {
             Alert.alert(
               'Download failed',
               'Unable to download data from '+url+"\nError:"+error,
               [{text: 'OK'}])
           });
  
  ...
  </code></pre>
  
  <p>The weird thing now is that whenever I  have some other runtime error in my code within <code>// Do stuff witt the successful result</code> block - for example an incorrectly cased reference to some constant or variable - that error will be handled by Axios' error handler, as well:</p>
  
  <p><a href="https://i.stack.imgur.com/LE8Ie.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/LE8Ie.jpg" alt="enter image description here"></a> </p>
  
  <p>That doesn't feel right. What am I doing wrong? Should I set up "generic" error handling somewhere else in my app to catch these things? Or is this intended behaviour?</p>