#59947 - 2001-10-19 12:01 AM
Re: Trapping a syntax error??
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
Currently the script is architected to execute the corporate stuff first then proceed in descending order of scope when calling the scripts ending up at the user. I just want to make a more bullet proof logon application. When the script bombs the logging stops. Since I currently log the calling of and returning from each script I know what script failed, but it just would be nicer to log that fact and continue.
|
|
Top
|
|
|
|
#59950 - 2001-10-19 05:05 PM
Re: Trapping a syntax error??
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
Who has Ruud's ear? I think that this is best resolved by parsing through or performing a pre-compile activity. The command IMHO should validate the syntax and if valid then continue with executuion. If the syntax is not valid, then execution should not happen and the "CALL" command should set @ERROR and @SERROR with the malformed line. This is still Beta. A "SUPERCALL" command could be added with minimal problems and would preserve backward compatibility and the testing that people have done to date.
|
|
Top
|
|
|
|
#59951 - 2001-10-19 05:41 PM
Re: Trapping a syntax error??
|
Richard H.
Administrator
   
Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
|
A pre-parse would have limited usefulnes. It is all to easy to write a script which will pass a parse ok, but fail when run. Dynamic scripts using execute and accessing array elements that don't exist are a couple of easy ways. Here is a simple example:
code:
dim $aArray[5]For $iI = 1 to 6 $iI $aArray[$iI] ? Next
There is nothing intrinsically wrong with the code, but the out of bounds reference will cause a fatal error. Being able to register a function which is called on a fatal error would be useful, with the reason for the failure passed as a paramater, or available through the @SERROR macro. The return value from the function could be used as a continue point in the script, so you could do something like:
code:
Break ON CLS; Set fatal error handler $sRestartPoint="" if OnFatalCall("udfMyErrorFunction") "Cannot register OnFatalCall function" ? Exit 1 EndIf ... ...Corporate script section... ... ... ... ... $RestartPoint="PostUserScript" $sUserScript="H:\Logon.kix" If Exist($sUserScript) CALL $sUserScript EndIf ; Restart here if user script fails. :PostUserScript $RestartPoint="" ... ... More corporate script ... ... ... ... Function udfMyErrorFunction($sReason) $=LogEvent(1,0,"Logon Script Failed due to: " + $sReason,@LSERVER) $udfMyErrorFunction=$sRestartPoint EndFunction
<edit> A null restart point would cause an abort as happens now. </edit> [ 19 October 2001: Message edited by: Richard Howarth ]
|
|
Top
|
|
|
|
#59952 - 2001-10-19 05:43 PM
Re: Trapping a syntax error??
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
|
|
Top
|
|
|
|
#59954 - 2001-10-19 08:58 PM
Re: Trapping a syntax error??
|
Shawn
Administrator
   
Registered: 1999-08-13
Posts: 8611
|
Les,You beat me to it ... we've already suggested an ON ERROR statement to Ruud and I know for a fact he's seen it - so the bug is (was) in his ear ... but all this talk of pre-parsing, etc makes me a little nervous ... seems a bit overkill no ? A statement like this should cover this off: ON ERROR statement eg: ON ERROR GOTO "ABORT" ON ERROR GOSUB "ABORT" ON ERROR ABORT() To keep on going : ON ERROR RESUME To toggle this feature on/off: ON ERROR 0 ; it's off ON ERROR GOTO ABORT ; it's back on You get the picture, basically a re-hash of the VB documentation ... the power of this approach comes from the fact that statement can be any old statement you want ... so this could work in Howards' situation and probably just about any other ... Another idea (off-topic) was to build a feature that trapped a user hitting (^C) or killing a (logon) script ... something like this: ON BREAK statement This would be very handy (I think) ... would allow one to properly trap (and cleanup) one's script prior to exiting .. maybe even allow one to cancel the pending abort ...
-Shawn
|
|
Top
|
|
|
|
#59957 - 2001-10-21 04:09 AM
Re: Trapping a syntax error??
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
We want to provide an environment where we have a common methodology and design to the corporate logon script. I have put a corporate kixtart script framework in place. The corporate logon script performs all the corporate stuff first. Then executes any number of scripts based on the OU hierarchy of both the user account in the global account domain and the computer account in the country resource domain. All of those are owned and operated by the regional, country, or local IT staffs as delegated by the OU structure. When writing those scripts they do have to understand the environment within they are writing their script.I have a set of published Global variables that they can use without gathering additional data. There is also a corporately control function library that provide things such as: 'MapDrive' and 'WriteLog'. These functions provide error checking, display data(if nec.), and logging. By using these functions all the scripts flow as one with the same look and feel that saves time and code. If they happen to re-assign a value to a global variable they only screw themselve or those downstream from them for which they are responsible. The user based scripts come last after all the corporate, regional, country, business unit, etc. stuff has already taken place. These scripts involve a special user-based Citrix script that the user can configure his Citrix session as he sees fit. Since we have Citrix users from all over the globe hitting the same server farm, we can not always know what his local drive mapping may be. If the user asks, he can get assistance setting this up. The user.kix that is stored in the user's home share executes last following the user where ever he goes and logs on. This is primarily used by the local LAN support and Help Desk staffs. They establish extra mappings to the software patches and drivers directories. Most of the computer are locked down so that the user can not hurt himself. For those that have the ability and do hurt themselves, LAN support charges the user's department time & materials and simply kicks off a computer rebuild. Two hours later, everthing is back to normal. The user assumes the risk. We provide the flexibility and to date it has worked quite well. I just want to improve it some more.  [ 21 October 2001: Message edited by: Howard Bullock ]
|
|
Top
|
|
|
|
#59958 - 2001-10-21 06:29 AM
Re: Trapping a syntax error??
|
MCA
KiX Supporter
   
Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
|
Thanks for your feedback Howard. Greetings.
|
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 756 anonymous users online.
|
|
|