public object HandleError(Exception exception) {
   if (exception is ScriptException)
     throw exception;
   var stack = GetStackTrace();
   var rex = new ScriptException(exception.Message, exception, CurrentNode.ErrorAnchor, stack);
   throw rex;
 }
Пример #2
0
        public object HandleError(Exception exception)
        {
            if (exception is ScriptException)
            {
                throw exception;
            }
            var stack = GetStackTrace();
            var rex   = new ScriptException(exception.Message, exception, CurrentNode.ErrorAnchor, stack);

            throw rex;
        }
Пример #3
0
        //Actual implementation
        private object EvaluateParsedScript()
        {
            LastScript.Tag = DataMap;
            var root = LastScript.Root.AstNode as AstNode;

            root.DependentScopeInfo = MainScope.Info;

            Status = AppStatus.Evaluating;
            ScriptThread thread = null;

            try {
                thread = new ScriptThread(this);
                var result = root.Evaluate(thread);
                if (result != null)
                {
                    thread.App.WriteLine(result.ToString());
                }
                Status = AppStatus.Ready;
                return(result);
            } catch (ScriptException se) {
                Status              = AppStatus.RuntimeError;
                se.Location         = thread.CurrentNode.Location;
                se.ScriptStackTrace = thread.GetStackTrace();
                LastException       = se;
                if (RethrowExceptions)
                {
                    throw;
                }
                return(null);
            } catch (Exception ex) {
                Status = AppStatus.RuntimeError;
                var se = new ScriptException(ex.Message, ex, thread.CurrentNode.Location, thread.GetStackTrace());
                LastException = se;
                if (RethrowExceptions)
                {
                    throw se;
                }
                return(null);
            }//catch
        }
Пример #4
0
    //Actual implementation
    private object EvaluateParsedScript() {
      LastScript.Tag = DataMap;
      var root = LastScript.Root.AstNode as AstNode;
      root.DependentScopeInfo = MainScope.Info;

      Status = AppStatus.Evaluating;
      ScriptThread thread = null;
      try {
        thread = new ScriptThread(this);
        var result = root.Evaluate(thread);
        if (result != null)
          thread.App.WriteLine(result.ToString());
        Status = AppStatus.Ready;
        return result; 
      } catch (ScriptException se) {
        Status = AppStatus.RuntimeError;
        se.Location = thread.CurrentNode.Location;
        se.ScriptStackTrace = thread.GetStackTrace();
        LastException = se;
        if (RethrowExceptions)
          throw;
        return null;
      } catch (Exception ex) {
        Status = AppStatus.RuntimeError;
        var se = new ScriptException(ex.Message, ex, thread.CurrentNode.Location, thread.GetStackTrace()); 
        LastException = se;
        if (RethrowExceptions)
          throw se;
        return null;

      }//catch

    }