Tommy
(Fresh Scripter)
2002-02-15 06:57 PM
Error Handling?

Is there anything similar to "On Error Resume Next" within KiXtart where it does not throw an error and exit the script?

Thanks,
Tommy

bleonard
(Seasoned Scripter)
2002-02-15 11:56 PM
Re: Error Handling?

Tommy -
Encountering an error condition will not cause your script to terminate. Scripts improperly formatted (missing closing quotations, incomplete IF/ENDIF or SELECT/CASE/ENDSELECT statements etc.) will cause the script to terminate.

KiX has extensive error codes that are returned (@ERROR/@SERROR), to provide complex scripting possibilities when a condition does not return the 'expected' return value.

So, if your script is aborting, your script needs to be checked. Suggest obtaining the standard for KiX script checking programs created by MCA, kixstrip, available at http://home.wanadoo.nl/scripting

Bill

Tommy
(Fresh Scripter)
2002-02-16 08:00 PM
Re: Error Handling?

Bill thanks for the reply.

The problem I am having is when I instantiate a custom COM+ Server. If the correct registry keys for the COM object do not exist on the client, the script will terminate. I know I can check to make sure each of the keys/values exist in the registry before instantiating the COM object, but that seams excessive to me. I would like the script to continue if it can’t run the COM object.

Any suggestions appreciated.

Thanks,
Tommy

ShawnAdministrator
(KiX Supporter)
2002-02-16 08:26 PM
Re: Error Handling?

Hi Tommy,

You can check for successfull object creation like this. This example tries to create script.filesystemobject.22, which doesn't exist ...


break on


$object = createobject("scripting.filesystemobject.22")


if not $object
?"Error instantiating object. taking appropriate steps ..."
else
?"All is well with wsh ..."
endif


exit 1

My assumption here is that failure to instantiate a COM+ object (for whatever reason) will still return back a NULL (not) pointer.

-Shawn

MCA
(KiX Supporter)
2002-02-17 04:08 AM
Re: Error Handling?

Dear,

At this moment nothing with capability is available in KiXtart language.
On the suggestion forum you can find all kind of new wishes.
Shawns reaction is only for specific location in your script. Sometime
necessary to prevent unexpected results.
greetings.

Tommy
(Fresh Scripter)
2002-02-18 06:19 PM
Re: Error Handling?

Thanks for the replies. Shawn's suggestion worked great for this instance. This site and its members are a great resource.

Thanks,
Tommy