是否存在PhantomJS中所有错误代码的列表?

时间:2016-02-04 16:14:15

标签: qt phantomjs error-code

我在Windows 7上使用PhantomJS V 2.1。当页面请求的资源根据onResourceTimeout超时时,将调用settings.resourceTimeout回调。回调的唯一参数是请求元数据对象。 请求元数据对象包含额外的错误相关属性:

  • errorCode:错误的错误代码
  • errorString:错误的短信

是否存在包含所有errorCode/errorString的描述的列表?

1 个答案:

答案 0 :(得分:4)

PhantomJS 2.1使用QT 5.5,你可以得到的错误来自QNetworkReplylink)。

以下是完整列表(source):

Constant                                         Value  Description
QNetworkReply::ConnectionRefusedError               1   the remote server refused the connection (the server is not accepting requests)
QNetworkReply::RemoteHostClosedError                2   the remote server closed the connection prematurely, before the entire reply was received and processed
QNetworkReply::HostNotFoundError                    3   the remote host name was not found (invalid hostname)
QNetworkReply::TimeoutError                         4   the connection to the remote server timed out
QNetworkReply::OperationCanceledError               5   the operation was canceled via calls to abort() or close() before it was finished.
QNetworkReply::SslHandshakeFailedError              6   the SSL/TLS handshake failed and the encrypted channel could not be established. The sslErrors() signal should have been emitted.
QNetworkReply::TemporaryNetworkFailureError         7   the connection was broken due to disconnection from the network, however the system has initiated roaming to another access point. The request should be resubmitted and will be processed as soon as the connection is re-established.
QNetworkReply::NetworkSessionFailedError            8   the connection was broken due to disconnection from the network or failure to start the network.
QNetworkReply::BackgroundRequestNotAllowedError     9   the background request is not currently allowed due to platform policy.
QNetworkReply::ProxyConnectionRefusedError          101 the connection to the proxy server was refused (the proxy server is not accepting requests)
QNetworkReply::ProxyConnectionClosedError           102 the proxy server closed the connection prematurely, before the entire reply was received and processed
QNetworkReply::ProxyNotFoundError                   103 the proxy host name was not found (invalid proxy hostname)
QNetworkReply::ProxyTimeoutError                    104 the connection to the proxy timed out or the proxy did not reply in time to the request sent
QNetworkReply::ProxyAuthenticationRequiredError     105 the proxy requires authentication in order to honour the request but did not accept any credentials offered (if any)
QNetworkReply::ContentAccessDenied                  201 the access to the remote content was denied (similar to HTTP error 401)
QNetworkReply::ContentOperationNotPermittedError    202 the operation requested on the remote content is not permitted
QNetworkReply::ContentNotFoundError                 203 the remote content was not found at the server (similar to HTTP error 404)
QNetworkReply::AuthenticationRequiredError          204 the remote server requires authentication to serve the content but the credentials provided were not accepted (if any)
QNetworkReply::ContentReSendError                   205 the request needed to be sent again, but this failed for example because the upload data could not be read a second time.  
QNetworkReply::ContentConflictError                 206 the request could not be completed due to a conflict with the current state of the resource.  
QNetworkReply::ContentGoneError                     207 the requested resource is no longer available at the server.  
QNetworkReply::InternalServerError                  401 the server encountered an unexpected condition which prevented it from fulfilling the request.  
QNetworkReply::OperationNotImplementedError         402 the server does not support the functionality required to fulfill the request.  
QNetworkReply::ServiceUnavailableError              403 the server is unable to handle the request at this time.  
QNetworkReply::ProtocolUnknownError                 301 the Network Access API cannot honor the request because the protocol is not known  
QNetworkReply::ProtocolInvalidOperationError        302 the requested operation is invalid for this protocol  
QNetworkReply::UnknownNetworkError                  99  an unknown network-related error was detected  
QNetworkReply::UnknownProxyError                    199 an unknown proxy-related error was detected  
QNetworkReply::UnknownContentError                  299 an unknown error related to the remote content was detected  
QNetworkReply::ProtocolFailure                      399 a breakdown in protocol was detected (parsing error, invalid or unexpected responses, etc.)  
QNetworkReply::UnknownServerError                   499 an unknown error related to the server response was detected  

可以在源代码中找到其他错误代码:

408  Network timeout on resource.