title: Pass error after catch on promises
body: <p>Hi I'm new so sorry if my question does not formulate properly.</p>
  
  <p>I want to define a promise from axios js in a global function.
  Here I want to handle / catch the 401 status globally and logout the user.
  I do not want to handle it in every single query.</p>
  
  <p>Here my source global function to handle a request:</p>
  
  <pre><code>export function requestData (url, payload = {}) {
    return axios.post(url, payload)
      .then(response =&gt; {
        return response.data
      })
      .catch(error =&gt; {
        if (error.response.status === 401) {
          logout()
        } else {
          return error
        }
      })
  }
  </code></pre>
  
  <p>And here a example function I use on a controller:</p>
  
  <pre><code>requestData('/api/persons', {options: this.options, search: search})
    .then(data =&gt; {
      this.data = data
    })
    .catch(error =&gt; {
      this.error = error.toString()
    })
  </code></pre>
  
  <p>My Problem is that the promise catch in my controller will not fire when there is an exception. How to realize this?</p>