Forum Discussion

joffre's avatar
joffre
Regular Contributor
11 years ago
Solved

How to Treat App Crash


I'm having some trouble with some old scripts.



Before, VBScript was used on our Automation Project, and I'm not aware about how to use that On Error GoTo to treat app's crashes.



Using try..catch would be easy, but how can I use On Error GoTo? TestComplete's help file isn't very clear.



On VB6, it would be like this (check line 2 and line 14):

Public Function addSGBD(model As String, description As String, server As String, user As String, password As String)

    On Error GoTo errvb

   

    description = Replace(description, "\", "\\")

    server = Replace(server, "\", "\")

    'server = Replace(server, "\", "\\")

    If rrSet("SELECT COUNT(*) AS qtd FROM gdt_sgbds WHERE description='" & description & "'", Conn).Fields("qtd").Value = 0 Then

        rrSet "INSERT INTO GDT_SGBDS(model,description,server,user,password) VALUES('" & model & "','" & description & "','" & server & "','" & user & "','" & crypt(password) & "')", Conn

        addSGBD = 1

    Else

        addSGBD = 1003

    End If

    Exit Function

errvb:

    GeraLog "GDT_LOG" & StrToData(Date), "AdministracaoDeSGBD.addSGBD" & vbCrLf & Err.Description

End Function




But VBScript doesn't work like that.



The log folder is attached as a zip file.



Hope someone can help me.