Page 1 of 1

Interceptar erro

Posted: Mon Feb 06, 2017 4:23 pm
by Wanderson
Olá,

Como posso interceptar este erro e evitar que o programa encerre?

line= oServerWS:send()

Error= Application
===========
Path and name: C:\BAIXA\VEBAIXADA.exe (32 bits)
Size: 2,065,408 bytes
Time from start: 0 hours 4 mins 6 secs
Error occurred at: 06/02/2017, 14:23:38
Error description: Error MSXML2.ServerXMLHTTP.6.0/3 DISP_E_MEMBERNOTFOUND: SEND

Obrigado.

Re: Interceptar erro

Posted: Mon Feb 06, 2017 4:37 pm
by VitalJavier
Buen dia
Yo lo tengo Asi :

Code: Select all


   TRY
      ohttp:send( doc:xml ) 
   CATCH
      MSGALERT( "Error", "No se mando la Solicitud de Web-Service, Inténtelo mas tarde...." )
      RETURN NIL
   END          

 
Hasta Ahorita no me ha mandado mensaje de error

Espero y te ayude. (O Quieres que te muestre que error es ? )

Re: Interceptar erro

Posted: Mon Feb 06, 2017 5:03 pm
by karinha

Code: Select all

   IF ISINTERNET()

      #IFDEF __XHARBOUR__  // xHarbour

         Try
             oServer:= CreateObject( "MSXML2.ServerXMLHTTP.6.0" )
         Catch
            MsgInfo('Erro na Criação do Serviço')
            Return .f.
         End

      #ELSE

         Try
            oServer:= win_OleCreateObject( "MSXML2.ServerXMLHTTP.5.0")
         Catch
            MsgInfo('Erro na Criação do Serviço!', 'Atenção!')
            exit
         End

      #ENDIF

      Try
         oServer:Open( "GET", URL_CONSULTA, .f. )
         oServer:SetRequestHeader( "Content-Type", "application/x-www-form-urlencoded" )
         oServer:SetRequestHeader( "Connection", "keep-alive" )
         oServer:Send()
         oServer:WaitForResponse( 10000 )
      Catch
         MsgInfo('Erro na conexão com o site!', 'Atenção!')
         exit
      End

   ELSE

      ? [SEM NET]

   ENDIF
 

Re: Interceptar erro

Posted: Mon Feb 06, 2017 5:28 pm
by Wanderson
VitalJavier wrote:Buen dia
Yo lo tengo Asi :

Code: Select all


   TRY
      ohttp:send( doc:xml ) 
   CATCH
      MSGALERT( "Error", "No se mando la Solicitud de Web-Service, Inténtelo mas tarde...." )
      RETURN NIL
   END          

 
Hasta Ahorita no me ha mandado mensaje de error

Espero y te ayude. (O Quieres que te muestre que error es ? )
Gracias, como mostrar que error es?

Re: Interceptar erro

Posted: Mon Feb 06, 2017 5:29 pm
by Wanderson
karinha wrote:

Code: Select all

   IF ISINTERNET()

      #IFDEF __XHARBOUR__  // xHarbour

         Try
             oServer:= CreateObject( "MSXML2.ServerXMLHTTP.6.0" )
         Catch
            MsgInfo('Erro na Criação do Serviço')
            Return .f.
         End

      #ELSE

         Try
            oServer:= win_OleCreateObject( "MSXML2.ServerXMLHTTP.5.0")
         Catch
            MsgInfo('Erro na Criação do Serviço!', 'Atenção!')
            exit
         End

      #ENDIF

      Try
         oServer:Open( "GET", URL_CONSULTA, .f. )
         oServer:SetRequestHeader( "Content-Type", "application/x-www-form-urlencoded" )
         oServer:SetRequestHeader( "Connection", "keep-alive" )
         oServer:Send()
         oServer:WaitForResponse( 10000 )
      Catch
         MsgInfo('Erro na conexão com o site!', 'Atenção!')
         exit
      End

   ELSE

      ? [SEM NET]

   ENDIF
 
Obrigado Karinha.