本文介绍API请求发生错误时的一些通用错误码。
当API请求发生错误的时候,服务端会返回错误信息,包括HTTP的Status Code和响应Body中的具体错误细节。其中响应Body中的错误细节为如下格式:
{
"errorCode" : <ErrorCode>,
"errorMessage" : <ErrorMessage>
}
在所有服务端可能返回的错误信息中,一部分适用于多数API,而另外一部分则为某些API所独有。下表即为API响应中的通用错误码,它们会在多个API响应中出现。而每个API所独有的错误码会在该API参考中单独描述。
HTTP 状态码(Status Code) | 错误码(Error Code) | 错误消息(Error Message) | 描述(Description) |
---|---|---|---|
411 | MissingContentLength | Content-Length does not exist in http header when it is necessary. | 没有提供必须的Content-Length请求头。 |
415 | InvalidContentType | Content-Type {type} is unsupported. | 不支持Content-Type指定的类型。 |
400 | MissingContentType | Content-Type does not exist in http header when body is not empty. | 没有为Body不为空的HTTP请求指定Content-Type头。 |
400 | MissingBodyRawSize | x-log-bodyrawsize does not exist in header when it is necessary. | 压缩场景下没有提供必须的x-log-bodyrawsize请求头。 |
400 | InvalidBodyRawSize | x-log-bodyrawsize is invalid. | x-log-bodyrawsize的值无效。 |
400 | InvalidCompressType | x-log-compresstype {type} is unsupported. | x-log-compresstype指定的压缩方式不支持。 |
400 | MissingHost | Host does not exist in http header. | 没有提供HTTP标准请求头Host。 |
400 | MissingDate | Date does not exist in http header. | 没有提供HTTP标准请求头Date。 |
400 | InvalidDateFormat | Date {date} must follow RFC822. | Date请求头的值不符合RFC822标准。 |
400 | MissingAPIVersion | x-log-apiversion does not exist in http header. | 没有提供HTTP请求头x-log-apiversion。 |
400 | InvalidAPIVersion | x-log-apiversion {version} is unsupported. | HTTP请求头x-log-apiversion的值不支持。 |
400 | MissAccessKeyId | x-log-accesskeyid does not exist in header. | 没有在Authorization头部提供AccessKeyId。 |
401 | Unauthorized | The AccessKeyId is unauthorized. | 提供的AccessKeyId值未授权。 |
400 | MissingSignatureMethod | x-log-signaturemethod does not exist in http header. | 没有提供HTTP请求头x-log-signaturemethod。 |
400 | InvalidSignatureMethod | signature method {method} is unsupported. | x-log-signaturemethod头部指定的签名方法不支持。 |
400 | RequestTimeTooSkewed | Request time exceeds server time more than 15 minutes. | 请求的发送时间超过当前服务处理时间前后15分钟的范围。 |
404 | ProjectNotExists | Project {name} does not exist. | 日志项目(Project)不存在。 |
401 | SignatureNotMatch | Signature {signature} is not matched. | 请求的数字签名不匹配。 |
403 | WriteQuotaExceed | Write quota is exceeded. | 超过写入日志限额。 |
403 | ReadQuotaExceed | Read quota is exceeded. | 超过读取日志限额。 |
500 | InternalServerError | Internal server error message. | 服务器内部错误。 |
503 | ServerBusy | The server is busy, please try again later. | 服务器正忙,请稍后再试。 |
错误消息中包括{…}部分为出错相关的具体信息。例如,ProjectNotExists的错误消息中包括{name},表示错误消息中该部分会被具体的Project Name来替换。