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())
    return
    content=reply.readAll().data()
    if content==b'':
    print('---------', 'cannot find any resource !')
    return

    @


  • 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
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.