Xử lý lỗi yêu cầu
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
API Routes Preferred trả về thông báo lỗi trong phản hồi của lệnh gọi phương thức. Ví dụ: nếu bạn bỏ qua khoá API khỏi yêu cầu, phương thức này sẽ trả về:
{
"error": {
"code": 403,
"message": "The request is missing a valid API key.",
"status": "PERMISSION_DENIED"
}
}
Nếu bạn bỏ qua một tham số bắt buộc của phần nội dung, chẳng hạn như origin
, thì phương thức này sẽ trả về:
{
"error": {
"code": 400,
"message": "Origin and destination must be set.",
"status": "INVALID_ARGUMENT"
}
}
Để biết thêm thông tin về lỗi và cách xử lý lỗi, hãy xem phần Lỗi.
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2024-11-23 UTC.
[[["Dễ hiểu","easyToUnderstand","thumb-up"],["Giúp tôi giải quyết được vấn đề","solvedMyProblem","thumb-up"],["Khác","otherUp","thumb-up"]],[["Thiếu thông tin tôi cần","missingTheInformationINeed","thumb-down"],["Quá phức tạp/quá nhiều bước","tooComplicatedTooManySteps","thumb-down"],["Đã lỗi thời","outOfDate","thumb-down"],["Vấn đề về bản dịch","translationIssue","thumb-down"],["Vấn đề về mẫu/mã","samplesCodeIssue","thumb-down"],["Khác","otherDown","thumb-down"]],["Cập nhật lần gần đây nhất: 2024-11-23 UTC."],[[["The Routes Preferred API utilizes error messages within its responses to indicate issues with method calls."],["These error messages provide specific details, including an error code, a descriptive message, and a status indicator, to help identify the cause of the error."],["Common errors include missing API keys, resulting in a \"PERMISSION_DENIED\" status, or omitting required parameters like \"origin,\" leading to an \"INVALID_ARGUMENT\" status."],["For a comprehensive understanding of errors and their handling within Google Cloud APIs, refer to the provided documentation on Errors."]]],[]]