错误返回
更新时间:2019-06-14
请求发生错误时通过respone body返回详细错误信息,遵循如下格式:
| 参数名 | 类型 | 说明 |
|---|---|---|
| code | String | 错误码 |
| message | String | 错误描述 |
| requestId | String | 本次请求的requestId |
示例:
Plain Text
1{
2 "requestId" : "ae2225f7-1c2e-427a-a1ad-5413b762957d",
3 "code" : "NoSuchKey",
4 "message" : "The resource you requested does not exist"
5}
错误码分百度智能云公共错误码和WAF服务特有错误码两类,具体错误码如下:
BCE公共错误码
| 错误返回码 | 错误消息 | 状态码 | 说明 |
|---|---|---|---|
| AccessDenied | Access denied. | 403Forbidden | 无权限访问对应的资源。 |
| InappropriateJSON | The JSON you provided was well-formed and valid, but not appropriate forthis operation. | 400 Bad Request | 请求中的JSON格式正确,但语义上不符合要求。如缺少某个必需项,或值类型不匹配等。出于兼容性考虑,对于所有无法识别的项应直接忽略,不应该返回这个错误。 |
| InternalError | We encountered an internal error Please try again. | 500 Internal Server Error | 所有未定义的其他错误。在有明确对应的其他类型的错误时(包括通用的和服务自定义的)不应该使用。 |
| InvalidAccessKeyId | The Access Key ID you provided doesnot exist in our records. | 403Forbidden | Access Key ID不存在。 |
| InvalidHTTPAuthHeader | The Access Key ID you provided does notexist in our records. | 400 BadRequest | Authorization头域格式错误。 |
| InvalidHTTPRequest | There was an error in the body of your HTTP request. | 400 Bad Request | HTTP body格式错误。例如不符合指定的Encoding等。 |
| InvalidURI | Could not parse the specified URI. | 400 Bad Request | URI形式不正确。例如一些服务定义的关键词不匹配等。对于ID不匹配的问题,应定义更加具体的错误码,如NoSuchKey。 |
| MalformedJSON | The JSON you provided was not well-formed. | 400 BadRequest | JSON格式不合法。 |
| InvalidVersion | The API version specified was invalid. | 404 NotFound | URI的版本号不合法。 |
| OptInRequired | A subscription for the service is required. | 403Forbidden | 没有开通对应的服务。 |
| PreconditionFailed | The specified If-Match header doesn’tmatch the ETag header. | 412PreconditionFailed | 详见Etag。 |
| RequestExpired | Request has expired. Timestamp date is <Data>. | 400 BadRequest | 请求超时。要改成x-bce-date。若请求中只有Date,需将Date转成datetime。 |
| IdempotentParameterMismatch | The request uses the same client token asa previous, but non-identical request. | 403Forbidden | clientToken对应的API参数不一样。 |
| SignatureDoesNotMatch | The request signature we calculated does not match the signature you provided. Check yourSecret Access Key and signing method. Consultthe service documentation for details. | 400 Bad Request | Authorization头域中附带的签名和服务端验证不一致。 |
Waf业务错误码
| 错误码 | 错误描述 | HTTP状态码 | 语义 |
|---|---|---|---|
| ReadWafDenied | No read waf permission | 403 | 无waf读服务权限 |
| OperateWafDenied | No operate waf permission | 403 | 无操作waf权限 |
| WafAdminDenied | No waf admin permission | 403 | 无waf管理权限 |
| UnsupportedWAFOperation | The status of specified waf does not support this operation | 400 | waf实例的状态不支持操作 |
| WafInterfaceError | The interface not supporte this kind of waf type | 400 | 调用的接口不支持传入的waf实例类型 |
| WafBindNotFound | The specified waf bind does not exist | 404 | 要绑定的blb未找到 |
| WafUnBindNotFound | The specified waf unbind does not exist | 404 | 要解除绑定的blb未找到 |
| WafBindRepeatError | The specified waf bind is repetition | 400 | waf已经绑定过blb了并且没解绑 |
| InvalidParameter | Invalid Parameters | 400 | 接口传入的参数不符合要求 |
