文档

错误处理

更新时间:

错误格式

当 PDS 在处理请求时,若发生异常,SDK 返回值形如

{
  "Message": "The input parameter file_id is not valid.",
  "RequestId": "772328B2-E5F4-453C-9C23-CCCCCCCC",
  "Code": "InvalidParameter"
}

且 HTTP 状态码也会相应变化。其中:

  • Code 为错误码,提示错误类型。
  • Message 为错误消息,提示错误的原因和解决办法。
  • RequestId 为请求的唯一 ID。(注意:在使用接口调用时,此参数在 Http Header: x-ca-request-id 中)

有少量场景,网关层报错,其错误码和错误代码形式如下:

x-ca-error-code: D504TO
x-ca-error-message: timeout
x-ca-request-id: 772328B1-E5F4-453C-9C23-CCCCCCCC

其中:

  • x-ca-error-code 为错误码,提示错误类型。
  • x-ca-error-message 为错误消息,提示错误的原因和解决办法。
  • x-ca-request-id 为请求的唯一 ID。

通用错误码表

以下列出了通用错误码表,涵盖大部分可能出现的错误。其中:

  • {parameter_name}和 {resource_name}在实际返回的响应中,分别对应字段名称和资源类型。
  • HTTP Status Code 列为响应的 HTTP 状态码。
  • Message 列中的信息可能与实际返回的响应略有不同,这通常是为了提示更具体的错误信息。
HTTP Status CodeCodeMessage
400InvalidParameterThe input parameter {parameter_name} is not valid.
400InvalidParameterEmptyThe input parameter {parameter_name} is empty.
400InvalidParameterWrongFormatThe input parameter {parameter_name} has invalid format.
400InvalidRequestJSONFormatThe input parameter {parameter_name} is invalid Json format.
400InvalidParameterNotSupportedThe input parameter {parameter_name} is not supported
400InvalidParameterMissingThe input parameter {parameter_name} is missing.
400InvalidParameterNotMatchThe input parameter {parameter_name} doesn’t match.
400InvalidParameterOutOfRangeThe input parameter {parameter_name} doesn’t match the limitation.
400InvalidParameterExpiredThe input parameter {parameter_name} is expired.
400QuotaExhaustedThe resource {resource_name} has exceeded the limit.
400InvalidResourceThe resource {resource_name} is not valid.
400NotEmptyThe resource {resource_name} is not empty.
404InvalidResourceIsEmptyThe resource {resource_name} is empty.
400InvalidResourceUnsupportedThe resource {resource_name} is not supported.
404NotFoundThe resource {resource_name} cannot be found.
400AlreadyExistThe resource {resource_name} has already exists
403ForbiddenUser not authorized to operate on the specified APIs.
403ForbiddenNoPermissionNo Permission to access resource {resource_name}.
403ForbiddenAccountNotFoundThe specified account does not exist.
403ForbiddenAccountInDebtThe specified account is in debt.
403ForbiddenServiceRoleCannot access specified service role.
403ForbiddenRiskControlThis operation is forbidden by Alibaba Cloud RiskControl system.
403ForbiddenFileInTheRecycleBinThis operation is forbidden for file in the recycle bin.
400StateConflictUser operation is not valid. Please try again later.
500InternalErrorThe request has been failed due to some unknown error. Please try again later
405HTTPMethodNotAllowedThe request http method is not supported for this resource. Please refer to document
503ServiceUnavailableThe request has failed due to a temporary failure of the server. Please try again later.
400ThrottlingThe operation is blocked due to throttling control.
400IncorrectStatusThe current status does not support this operation.
400InvalidHeaderHeader {header_name} is not valid.
400SignatureDoesNotMatchSignatureDoesNotMatch
400DriveRelativePathNestedThe input parameter relative_path nested inside of another relative_path: {path}.
400Sha1ConflictFind multiple objects of the same sha1.
400ReadBodyErrorRead body error.

如有任何问题,欢迎 联系我们