title: vue-resource: catch "Uncaught (in promise)" when intercepting an ajax error
body: <p>I'm using <code>vue-resource</code> to fetch data from the server. A user needs to have a JWT token to get the correct data. If the token is invalid or expired, a 401 status is returned. If the user tries to access a forbidden page, a 403 is returned.</p>
  
  <p>I would like to catch those errors and handle them appropriately (globally). This means, that the calls should be completely handled by the interceptor (if 401, 403).</p>
  
  <p>How can I prevent the browser message "Uncaught (in promise)" and create some global error handling? I don't want to have a local error handler on every call.</p>
  
  <p>I have the following interceptor:</p>
  
  <pre><code>Vue.http.interceptors.push(function (request, next) {
      request.headers.set('Authorization', Auth.getAuthHeader());
  
      next(function (response) {
          if (response.status === 401 || response.status === 403) {
              console.log('You are not logged in or do not have the rights to access this site.');
          }
      });
  });
  </code></pre>
  
  <p>And the following call in the Vue <code>methods</code>:</p>
  
  <pre><code>methods: {
      user: function () {
          this.$http.get('http://localhost:8080/auth/user').then(function (response) {
              console.log(response);
          });
      }
  }
  </code></pre>