Important: Please read the Qt Code of Conduct -

Detect all the network erroneous cases with Qt

  • I want to get Page Source by the following code ,I wonder is it enough to detect all the network erroneous cases with the following code ?
    if (reply.error()!= QNetworkReply.NoError):
    print('11111111', reply.errorString())
    if content==b'':
    print('---------', 'cannot find any resource !')


  • Moderators

    it's enough if you don't care about the specific type of the error...
    But a reply is either successful or not. Qt delivers you error types if it recognizes them, if not it still knows that a error happened and returns QNetworkReply::UnknownNetworkError.

Log in to reply