Forum Discussion

yclui's avatar
12 years ago

How to catch Sys error or exception

I am a new TestComplete user and try out the following JScript code to see how Sys handles error:




function func001()


func001()

{


    try


    {


        if ( Sys.Process("cmd").Exists )


        {


            Log.Message( "Process exist ..." );


            Sys.Process("cmd").Close();


        }


        else


            Log.Message( "Process does not exist ..." );


    }


    catch ( e )


    {


        Log.Message("Exception thrown ...");


        Log.Error( e );


    }


}



Does Sys method call throw any exception on error ?  How do handle error in this case ?



Thank you! 



Alex.