#198895 - 2010-06-22 05:49 PM
Re: Avoiding premature Script exits on errors
[Re: AndreasBucher]
|
Richard H.
Administrator
   
Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
|
The simple answer is no, you cannot trap a code error.
Most interpreted languages will abend if you mangle things badly enough. KiXtart is very forgiving, but if (for example) you try to reference an invalid array element, or divide by zero then it will stop.
KiXtart is pretty hard to break if you code for exceptions and check data instead of just assuming that it's OK.
Objects are the one thing that can really bite you - you don't have any control over how they react so they can halt the script before you get a chance to manage any exception.
One method I use when I want to sandbox a child script but still share variables is:
- Parent creates a script contaning the variables in a new file in $FOO="bar" format.
- Parent executes the child script in a new instance of KiXtart.
- Child CALLs the variable script to load the variables.
- Child executes.
- Child re-writes the variable script file using the updated variables.
- Child write it's state to the variable script file and exits
- Parent CALLs the variable script file to load the updated variables and checks the child finish state, raising an alert if the child failed.
Objects are you only problem here again, as you can't store the instance in a text file in any simple way.
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 677 anonymous users online.
|
|
|