จัดการข้อผิดพลาดคําขอ
Routes API จะแสดงข้อความแสดงข้อผิดพลาดเป็นส่วนหนึ่งของการตอบกลับการเรียกเมธอด ตัวอย่างเช่น หากคุณละเว้นคีย์ API จากคำขอ เมธอดจะแสดงผลดังนี้
{
"error": {
"code": 403,
"message": "The request is missing a valid API key.",
"status": "PERMISSION_DENIED"
}
}
หากคุณละเว้นพารามิเตอร์ของเนื้อหาที่ต้องระบุ เช่น origin
วิธีการจะแสดงผลดังนี้
{
"error": {
"code": 400,
"message": "Origin and destination must be set.",
"status": "INVALID_ARGUMENT"
}
}
ดูข้อมูลเพิ่มเติมเกี่ยวกับข้อผิดพลาดและการจัดการข้อผิดพลาดได้ที่ข้อผิดพลาด
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-02-06 UTC
[null,null,["อัปเดตล่าสุด 2025-02-06 UTC"],[[["The Routes API provides error messages within its responses to indicate issues with the request."],["Errors are returned as JSON objects containing an `error` field with details about the issue, such as a code, message, and status."],["Missing API keys result in a `PERMISSION_DENIED` error with a 403 code."],["Omitting required parameters like `origin` leads to an `INVALID_ARGUMENT` error with a 400 code."],["Further details on errors and their handling can be found in the Google Cloud API Design Guide on Errors."]]],[]]