错误响应

MNS的错误响应格式

当用户访问MNS出错时,MNS会返回给用户一个合适的3xx,4xx或者5xx的HTTP状态码;以及一个text/xml格式的消息体。

错误响应的消息体例子:

    <?xml version="1.0"  encoding="UTF-8"?>
    <Error xmlns="http://mns.aliyuncs.com/doc/v1/">
        <Code>InvalidArgument</Code>
        <Message>Authorization header is invalid or missing.</Message>
        <RequestId>04bb60e3-28aa-4706-99b0-9345d834f266</RequestId>
        <HostId>mns.cn-hangzhou.aliyuncs.com</HostId>
    </Error>

所有错误的消息体中都包括以下几个元素:

  • Code:MNS返回给用户的错误码。
  • Message:MNS给出的详细错误信息。
  • RequestId:用于唯一标识该次请求的编号;当你无法解决问题时,可以凭这个RequestId来请求MNS支持工程师的帮助。
  • HostId:用于标识访问的MNS集群。

其他特殊的错误信息元素请参照每个请求的具体介绍。

MNS错误码表

错误码 错误描述 HTTP状态码
AccessDenied The OwnerId that your Access Key Idassociated to is forbidden for this operation. 403
InvalidAccessKeyId The AccessKey Id you provided is not exist. 403
InternalError Interal error. 500
InvalidAuthorizationHeader The Authorization header format is invalid. 400
InvalidDateHeader The Date header format is invalid. 400
InvalidArgument The XML you provided did not validate against our published schema, cause by Element① Element. 400
InvalidArgument The value of Element②should between Low③ and High④ seconds/bytes. 400
InvalidDegist The Content-MD5 you specified is invalid. 400
InvalidRequestURL Http request URL format invalid. 400
InvalidQueryString Http request URL contains invalid querystring item “Element⑤”. 400
MalformedXML The XML you provided was not well-formed. 400
MissingAuthorizationHeader Authorization header is required. 400
MissingDateHeader Date header is required. 400
MissingReceiptHandle ReceiptHandle is required. 400
MissingVisibilityTimeout VisibilityTimeout is required. 400
MessageNotExist Message not exist. 404
QueueAlreadyExist The queue you want to create is already exist. 409
QueueDeletedRecently The queue you want to create is deleted recently. 400
InvalidQueueName The queue name you provided is invalid. QueueName should start with alpha and contain only alpha, digit or - . 400
QueueNameLengthError Queue name length should between 1 and 256. 400
QueueNotExist The queue name you provided is not exist. 404
ReceiptHandleError The receipt handle you provide is not valid. 400
SignatureDoesNotMatch The request signature we calculated does not match the signature you provided. Check your key and signing method. 403
TimeExpired The http request you sent is expired. 408
QpsLimitExceeded The qps limit of the queue is exceeded ⑥ 400

说明:

①②表示在请求内容的XML元素名称

③表示在MNS中某个参数的下限值

④表示在MNS中某个参数的上限值

⑤表示在URL请求中QueryString的元素

⑥当前MNS单个queue的qps上限是2k

results matching ""

    No results matching ""