From 638cce09d141a27627c6fa1aa65647df064a6eff Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Tue, 7 Oct 2008 21:59:56 +0000 Subject: Restore "friendly errors" to the XEngine --- .../Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs') diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs index e8f2b71..a825eff 100644 --- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs +++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs @@ -99,10 +99,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools string message; // LL start numbering lines at 0 - geeks! + // Also need to subtract one line we prepend! // + string emessage = e.Message; + string slinfo = e.slInfo.ToString(); + + // Remove wrong line number info + // + if (emessage.StartsWith(slinfo+": ")) + emessage = emessage.Substring(slinfo.Length+2); + message = String.Format("Line ({0},{1}) {2}", - e.slInfo.lineNumber - 1, - e.slInfo.charPosition - 1, e.Message); + e.slInfo.lineNumber - 2, + e.slInfo.charPosition - 1, emessage); throw new Exception(message); } -- cgit v1.1