示例#1
0
        private void RuntimeError(RuntimeError error)
        {
            string line = error.Token?.Line.ToString() ?? "unknown";

            standardOutputHandler($"[line {line}] {error.Message}");
            hadRuntimeError = true;
        }
示例#2
0
        /// <summary>
        /// Generate detailed report when the simulator crashs
        /// </summary>
        /// <param name="e">The error caused the crash</param>
        /// <returns>Detailed error message</returns>
        private string GenerateDebugInformation(RuntimeError e)
        {
            string s = "";

            s += "\n\nDEBUG Information:\n---------------------------------\n";
            for (int iCounter = 0; iCounter < 12; iCounter++)
            {
                s += "R" + iCounter + "=" + theSimulator.R[iCounter].ToString16() + "\t";
            }
            s += "AP=" + theSimulator.R[12].ToString16() + "\tFP=" + theSimulator.R[13].ToString16() + "\tSP=" +
                 theSimulator.R[14].ToString16() + "\tPC=" + theSimulator.R[15].ToString16() + "\t";
            s += "C=" + theSimulator.R.PSL.C + "\tV=" + theSimulator.R.PSL.V
                 + "\tN=" + theSimulator.R.PSL.N + "\tZ=" + theSimulator.R.PSL.Z + "\n";
            s += "Error occured at address " + Convert.ToString(e.PC, 16) + "\n";
            s += "STACK:\n---------------------------------\n";

            int iCurrAddr = theSimulator.R[14];

            for (int iCounter = 0; iCounter < 3; ++iCounter)             // 3 = number of lines
            {
                s += "0x" + Convert.ToString(iCurrAddr, 16) + ":\t";
                for (int i = 0; i < 8; ++i)
                {
                    s         += Convert.ToString((uint)theSimulator.memory.Read(iCurrAddr, 4, false), 8).ToUpper() + "\t";
                    iCurrAddr += 4;
                }
                s += "\n";
            }
            return(s);
        }
        public override int GetHashCode()
        {
            int hash = 1;

            if (resultCase_ == ResultOneofCase.ParseError)
            {
                hash ^= ParseError.GetHashCode();
            }
            if (resultCase_ == ResultOneofCase.SerializeError)
            {
                hash ^= SerializeError.GetHashCode();
            }
            if (resultCase_ == ResultOneofCase.RuntimeError)
            {
                hash ^= RuntimeError.GetHashCode();
            }
            if (resultCase_ == ResultOneofCase.ProtobufPayload)
            {
                hash ^= ProtobufPayload.GetHashCode();
            }
            if (resultCase_ == ResultOneofCase.JsonPayload)
            {
                hash ^= JsonPayload.GetHashCode();
            }
            if (resultCase_ == ResultOneofCase.Skipped)
            {
                hash ^= Skipped.GetHashCode();
            }
            hash ^= (int)resultCase_;
            return(hash);
        }
示例#4
0
文件: Runtime.cs 项目: Lopla/Language
        public void AddError(RuntimeError e)
        {
            var stackName = $"{_processors?.Get()?.RootStackName()}";

            e.Text = $"{stackName}\t{e.Text}";

            AddError((Error)e);
        }
示例#5
0
 private void ClearRuntimeError()
 {
     if (FLastRuntimeError != null)
     {
         FErrorList.Remove(FLastRuntimeError);
         FLastRuntimeError       = null;
         FLastRuntimeErrorString = null;
         FEditor.ClearRuntimeErrors();
     }
 }
        /// <summary>
        /// Reports a non-functioning asset to the runtime framework.
        /// </summary>
        /// <param name="assetInfo">The <see cref="IAssetInfo" /> representing the asset in error.</param>
        /// <exception cref="ArgumentNullException"><paramref name="assetInfo" /> is null.</exception>
        public void ReportAssetError(IAssetInfo assetInfo)
        {
            if (assetInfo == null)
            {
                throw new ArgumentNullException(nameof(assetInfo));
            }

            RuntimeError assetError = new RuntimeError(assetInfo.AssetId);

            SessionProxyBackendConnection.HandleAssetError(assetError);
        }
示例#7
0
        public void Evaluate(int SpreadMax)
        {
            if (FAttachedNode != null)
            {
                var lastRuntimeErrorString = FAttachedNode.LastRuntimeError;

                if (!string.IsNullOrEmpty(lastRuntimeErrorString))
                {
                    if (lastRuntimeErrorString != FLastRuntimeErrorString)
                    {
                        if (FLastRuntimeError != null)
                        {
                            FErrorList.Remove(FLastRuntimeError);
                        }

                        FLastRuntimeError = new RuntimeError(lastRuntimeErrorString);
                        FErrorList.Add(FLastRuntimeError);

                        FEditor.ShowRuntimeErrors(new RuntimeError[] { FLastRuntimeError });
                    }
                    FLastRuntimeErrorString = lastRuntimeErrorString;
                }
                else
                {
                    ClearRuntimeError();
                }
            }
            else
            {
                ClearRuntimeError();
            }

            // Show or hide error table
            if (IsErrorTableVisible)
            {
                if (FErrorList.Count == 0)
                {
                    HideErrorTable();
                }
            }
            else if (FErrorList.Count > 0)
            {
                ShowErrorTable();
            }
        }
示例#8
0
        /// <summary>
        /// Handles the runtime error for this host.
        /// </summary>
        /// <param name="error">The error information.</param>
        public override bool HandleError(RuntimeError error)
        {
            TraceFactory.Logger.Debug(error.ErrorId);

            lock (_lockObject)
            {
                // Determine if the error is already being handled, if so then return,
                // if not, set the flag that this thread will take care of it.
                if (!_isHandlingError)
                {
                    TraceFactory.Logger.Debug("Handling error set true");
                    // Turn on indicator that this thread is already handling the error
                    _isHandlingError = true;
                }
                else
                {
                    // The error is already being handled, so return
                    TraceFactory.Logger.Debug("Error for {0} is already being handled, returning...".FormatWith(_machine.Name));
                    return(true);
                }
            }
            bool success;

            // Attempt to power up the simulator, indicate failure if it doesn't work.
            if (!PowerUpSimulator())
            {
                MapElement.UpdateStatus("Recovery Failed", RuntimeState.Error);
                success = false;
            }
            else
            {
                MapElement.UpdateStatus("Running");
                success = true;
            }

            // Turn off indicator that a thread is already handling the error
            lock (_lockObject)
            {
                TraceFactory.Logger.Debug("HandlingError = false");
                _isHandlingError = false;
            }

            return(success);
        }
示例#9
0
 public void ReportRuntimeError(RuntimeError error)
 {
     Console.WriteLine($"{error.Message}\n[line {error.Token.Line}]");
 }
示例#10
0
 public RuntimeErrorCellProvider(RuntimeError error)
 {
     FError = error;
 }
示例#11
0
 public static void RuntimeError(RuntimeError error)
 {
     Console.WriteLine($"{error.Message}\n[line {error.token.Line}]");
     hadRuntimeError = true;
 }
示例#12
0
 /// <summary>
 /// Handles the runtime error for this print queue.
 /// </summary>
 /// <param name="error">The error information.</param>
 public virtual void HandleError(RuntimeError error)
 {
     // Implemented as needed by child classes
 }
示例#13
0
 protected void InvokeRuntimeError(ErrorWithPath error)
 {
     SaveErrorMessage(error);
     RuntimeError?.Invoke(error);
 }
示例#14
0
 void AddError(StatementList statements, Identifier reader, RuntimeError code, params Expression[] args) {
   ExpressionList list = new ExpressionList();
   list.Add(new Literal(code, Runtime.RuntimeError));
   foreach (Expression e in args) list.Add(e);
   statements.Add(new ExpressionStatement(new MethodCall(new QualifiedIdentifier(reader, Identifier.For("Error")), list)));
 }
示例#15
0
 public RuntimeException(string message, RuntimeError error)
     : base(message)
 {
     Error = error;
 }
示例#16
0
 // "Gracfully" report the error back to the user, without bombing.
 internal static void RuntimeError(RuntimeError ex)
 {
     Console.WriteLine($"{ex.Message}\n[Line: {ex.Token.Line}]");
     hadRuntimeError = true;
 }
示例#17
0
 public RuntimeException(string message, RuntimeError error)
     : base(message)
 {
     Error = error;
 }
示例#18
0
 public static void RuntimeError(RuntimeError error)
 {
     log.Error($"[line {error.Token.LineNumber}] {error.Message}");
     RuntimeErrorOccured = true;
 }
示例#19
0
 public void AddRuntimeError(RuntimeError err)
 {
     throw new NotImplementedException();
 }
 public static void HandleAssetError(RuntimeError error)
 {
     SessionProxyBackendConnection.Run(c => c.HandleAssetError(error));
 }
示例#21
0
 private static void AssertFailRuntimeErrorHandler(RuntimeError runtimeError)
 {
     throw runtimeError;
 }
示例#22
0
 /// <summary>
 /// Handles the runtime error for this host.
 /// </summary>
 /// <param name="error">The error information.</param>
 public virtual bool HandleError(RuntimeError error)
 {
     // Implemented as needed by child classes
     return(true);
 }
示例#23
0
 public static void DisplayRuntimeError(RuntimeError error)
 {
     Console.Error.WriteLine("[line " + error._token._line + "] Runtime Error: " + error.Message);
     _hadRuntimeError = true;
 }
示例#24
0
 private static void AssertFailRuntimeErrorHandler(RuntimeError runtimeError)
 {
     throw new Exception($"RuntimeError occurred: {runtimeError.Message}", runtimeError);
 }
示例#25
0
 private static void runtimeError(RuntimeError error)
 {
     Console.Error.WriteLine($"{error.Message} \n[line {error.token.line} ]");
     hadRuntimeError = true;
 }
示例#26
0
文件: Lox.cs 项目: jonnyboyC/cs-Lox
 internal static void RuntimeError(RuntimeError error)
 {
     Reporter.ReportRuntimeError(error);
     HadRuntimeError = true;
 }