const promise = new Promise((resolve, reject) => {
axios({
url,
method,
baseURL: API_URL,
data: Object.assign({ api_key: localStorageService.get('api_key') }, query),
transformRequest: [params => requestUtils.objectToQueryString(params)],
headers: { 'content-type': 'application/x-www-form-urlencoded' }
}).then(response => {
console.log('first then', error);
return response.data.ok
? resolve(this.successModel(query, response, data))
: reject(this.errorModel(query, {response}, data))
})
.catch((error) => {
console.log('first catch', error);
return reject(this.errorModel(query, error, data));
});
})
.catch(e => console.log('second catch', e));
При ошибке 'first catch' отрабатывае, а 'second catch' нет, почему?