Axios 捕获 Promise 错误

Axios catching a Promise Error

我有以下 axios 调用:

axios.put({API_IMAGE_URL}}`, imageData, { withCredentials: true, headers: { 'Content-Type': 'multipart/form-data' } })
                .then(response => {
                    axios.get(`${API_URL}/images/${response.data.id}`, { withCredentials: true, headers: { 'Content-Type': 'multipart/form-data' } })
                        .then(response => {
                            var newFormat = response.data;
                            dispatch(updateFormat(newFormat))
                        });
                }).catch((e) => {
                    console.log("Can't update image ", e);

基本上我有一个图像对象被传递给 url。从那里,我需要检索具有新 ID 的新 Image 对象以用于其他用途。

如果我的图片太大,会出现以下错误:

413 (Request Entity Too Large)
Uncaught (in promise) Error: Network Error 

我的问题就出在这里。它给了我这些错误并且不转到 catch 子句。有没有办法捕获这些承诺错误?

只是 return 第二个 axios promise 是这样的

    axios.put({API_IMAGE_URL}}`, imageData, { withCredentials: true, headers: { 'Content-Type': 'multipart/form-data' } }).then(response => {
        // Return the promise from here like this
        return axios.get(`${API_URL}/images/${response.data.id}`, { withCredentials: true, headers: { 'Content-Type': 'multipart/form-data' } }).then(response => {
            var newFormat = response.data;
            dispatch(updateFormat(newFormat))
       });
   }).catch((e) => {
       console.log("Can't update image ", e);