นี่อาจดูเหมือนโง่ แต่ฉันพยายามรับข้อมูลข้อผิดพลาดเมื่อคำขอล้มเหลวใน Axios
axios.get('foo.com')
    .then((response) => {})
    .catch((error) => {
        console.log(error) //Logs a string: Error: Request failed with status code 404
    })แทนที่จะเป็นสตริงมันเป็นไปได้ไหมที่จะรับอ็อบเจกต์ด้วยรหัสสถานะและเนื้อหา? ตัวอย่างเช่น:
Object = {status: 404, reason: 'Not found', body: '404 Not found'}
responseคุณสมบัตินี้?