无法打印错误信息

Can't print error message

当用户尝试更改密码但失败时,我想向用户显示后端的消息。

对于 Postman,它正在打印带有 400 Bad Request 的有效(?)错误消息

{
    "old_password": [
        "Invalid password"
    ]
}

但是这里我无法打印这里的错误信息

try {
    let headers = { ...};

    let response = await axios.post(`${ROOT_URL}/.../`, {
      old_password: currentPassword,
      new_password1: passwordOne,
      new_password2: passwordTwo,
    }, {
      headers
    });
    if (response.status ===200) {
        dispatch({ type: CHANGE_PASSWORD_SUCCESS, payload: response.data });
    }
    callback();
  } catch(error) {
    console.log(error); <- [400 error] //but I can't read this!!
    console.log('error'); 
    console.log(error.data); //undefined
    console.log(error.old_password); //undefined
    callback2(error);
  }

console.log(error.response.data) 有效