public override void Update(float time)
{
try
{
base.Update(time);
EvaluateNextCommand();
}
catch (kOSException e)
{
if (ParentContext.FindClosestParentOfType<ContextRunProgram>() != null)
{
// Error occurs in a child of another running program
StdOut("Error in '" + e.Program.Filename + "' on line " + e.LineNumber + ": " + e.Message);
State = ExecutionState.DONE;
return;
}
else
{
// Error occurs in the top level program
StdOut("Error on line " + e.LineNumber + ": " + e.Message);
State = ExecutionState.DONE;
return;
}
}
catch (Exception e)
{
// Non-kos exception! This is a bug, but no reason to kill the OS
StdOut("Flagrant error on line " + executionLine);
UnityEngine.Debug.Log("Program error");
UnityEngine.Debug.Log(e);
State = ExecutionState.DONE;
return;
}
}