private void FillDebugData(InterpreterException ex, int ip) { // adjust IP if (ip == YIELD_SPECIAL_TRAP) { ip = m_SavedInstructionPtr; } else { ip -= 1; } ex.InstructionPtr = ip; SourceRef sref = GetCurrentSourceRef(ip); if (sref != null) { ex.DecoratedMessage = string.Format("{0}: {1}", sref.FormatLocation(m_Script), ex.Message); } else { ex.DecoratedMessage = string.Format("bytecode:{0}: {1}", ip, ex.Message); } ex.CallStack = Debugger_GetCallStack(sref); }
string FormatExceptionMessage(InterpreterException e) { string msg = ""; if (e is InternalErrorException) { msg += "Internal Error "; } else if (e is SyntaxErrorException) { msg += "Syntax Error "; } else if (e is DynamicExpressionException) { msg += "Dynamic Error "; } else if (e is ScriptRuntimeException) { msg += "Runtime Error "; } else { msg += "Interpreter Error"; } string error_msg = e.DecoratedMessage; int pos = error_msg.IndexOf('('); int length = error_msg.LastIndexOf(')') - pos + 1; msg += error_msg.Substring(pos, length) + ": "; msg += error_msg.Substring(error_msg.IndexOf(' ')); return(msg); }
public ParserException(InterpreterException e, string reference) { this.message = "Error on Interpreter"; this.reference = reference; this.description = e.Message; this.Parse(e.DecoratedMessage); }
public void ThrowExceptionToConsole(InterpreterException ex) { string niceMessage = ex.DecoratedMessage; niceMessage = niceMessage.Replace(@"\", "/"); int modulesIndex = niceMessage.IndexOf("modules"); niceMessage = niceMessage.Substring(modulesIndex, niceMessage.Length - modulesIndex); ConsoleController.ThrowError(niceMessage); }
private void InterpreterOnLuaError(object sender, InterpreterException exception) { void MethodInvokerDelegate() { Critical($">>> {Resources.LogError}:"); Critical($">>> {exception.DecoratedMessage}"); } Invoke((MethodInvoker)MethodInvokerDelegate); }
private static void Log(InterpreterException e) { string decoratedMessage = e.DecoratedMessage; if (string.IsNullOrEmpty(decoratedMessage)) { Log((Exception)e); return; } string culpritFilePath = parsedFilePaths[int.Parse(decoratedMessage.Substring(6, decoratedMessage.IndexOf(":", StringComparison.Ordinal) - 6)) - 1]; Logger.Log("Lua", string.Format("{0}\n at {1}", decoratedMessage, culpritFilePath), LoggerVerbosity.Error); }
private void FillDebugData(InterpreterException ex, int ip) { // adjust IP if (ip == YIELD_SPECIAL_TRAP) ip = m_SavedInstructionPtr; else ip -= 1; ex.InstructionPtr = ip; var sref = GetCurrentSourceRef(ip); ex.DecorateMessage(m_Script, sref, ip); ex.CallStack = Debugger_GetCallStack(sref); }
private void FillDebugData(InterpreterException ex, int ip) { // adjust IP if (ip == YIELD_SPECIAL_TRAP) { ip = _savedInstructionPtr; } else { ip -= 1; } ex.InstructionPtr = ip; var sref = this.GetCurrentSourceRef(ip); ex.DecorateMessage(_script, sref, ip); }
public void EnsureSerializationOfException() { InterpreterException ex = null; try { throw new InterpreterException("TEST"); } catch (InterpreterException e) { ex = e; } Assert.IsNotNull(ex); BinaryFormatter bf = new BinaryFormatter(); using (MemoryStream ms = new MemoryStream()) { bf.Serialize(ms, ex); ms.Position = 0; ex = (InterpreterException)bf.Deserialize(ms); Assert.AreEqual("TEST", ex.Message); } }
private void FillDebugData(InterpreterException ex, int ip) { // adjust IP if (ip == YIELD_SPECIAL_TRAP) { ip = m_SavedInstructionPtr; } else { ip -= 1; } ex.InstructionPtr = ip; SourceRef sref = GetCurrentSourceRef(ip); ex.DecorateMessage(m_Script, sref, ip); ex.CallStack = Debugger_GetCallStack(sref); }