diff options
author | Charles Krinke | 2008-08-13 14:58:26 +0000 |
---|---|---|
committer | Charles Krinke | 2008-08-13 14:58:26 +0000 |
commit | 4a2d5d92ccb74c0715b8f93b4feae9ed15ef5177 (patch) | |
tree | 3dcd2ad08e6b4b33c8c0cef53a7b6bf9bfefa78b /OpenSim | |
parent | Mantis#1856. Thank you kindly, HomerHorwitz for a patch that: (diff) | |
download | opensim-SC-4a2d5d92ccb74c0715b8f93b4feae9ed15ef5177.zip opensim-SC-4a2d5d92ccb74c0715b8f93b4feae9ed15ef5177.tar.gz opensim-SC-4a2d5d92ccb74c0715b8f93b4feae9ed15ef5177.tar.bz2 opensim-SC-4a2d5d92ccb74c0715b8f93b4feae9ed15ef5177.tar.xz |
Mantis#1941. Thank you kindly, Tyre for a patch that
makes progress in extracting the line number of LSL
script execution errors.
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueThreadClass.cs | 38 |
1 files changed, 4 insertions, 34 deletions
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueThreadClass.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueThreadClass.cs index dc97174..7dfac62 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueThreadClass.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueThreadClass.cs | |||
@@ -28,6 +28,7 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.Collections; | 29 | using System.Collections; |
30 | using System.Reflection; | 30 | using System.Reflection; |
31 | using System.Text.RegularExpressions; | ||
31 | using System.Threading; | 32 | using System.Threading; |
32 | using System.Globalization; | 33 | using System.Globalization; |
33 | using libsecondlife; | 34 | using libsecondlife; |
@@ -303,41 +304,10 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
303 | if (e.InnerException != null) | 304 | if (e.InnerException != null) |
304 | { | 305 | { |
305 | // Send inner exception | 306 | // Send inner exception |
306 | string[] lines=e.InnerException.ToString().Replace("\r", "").Split('\n'); | ||
307 | string line = " (unknown line)"; | 307 | string line = " (unknown line)"; |
308 | foreach (string t in lines) | 308 | Regex rx = new Regex(@"SecondLife\.Script\..+[\s:](?<line>\d+)\.?\r?$", RegexOptions.Compiled); |
309 | { | 309 | if (rx.Match(e.InnerException.ToString()).Success) |
310 | int idx=t.IndexOf("SecondLife.Script."); | 310 | line = " (line " + rx.Match(e.InnerException.ToString()).Result("${line}") + ")"; |
311 | if (idx != -1) | ||
312 | { | ||
313 | // Need to skip past windows paths that have "c:\" in them | ||
314 | int colon=t.LastIndexOf(":"); | ||
315 | |||
316 | if (-1 != colon) | ||
317 | { | ||
318 | // Not sure why this is converted to an int then back to a string, either | ||
319 | // way, need to skip the word "line " in the substring | ||
320 | try | ||
321 | { | ||
322 | // ...if it is there. With mono --debug OpenSim.exe, | ||
323 | // you'll get the error in the format filename:linenumber | ||
324 | if (colon + 6 < t.Length && t.Substring(colon + 1, 5).Equals("line ")) colon += 6; | ||
325 | else ++colon; // else only skip the colon | ||
326 | line = " at line " + Convert.ToInt32(t.Substring(colon)).ToString(); | ||
327 | } | ||
328 | catch (ArgumentOutOfRangeException e2) | ||
329 | { | ||
330 | // FIXME: Big fat temporary patch to stop the Substring above throwing an exception | ||
331 | // and stopping a proper kill of the script. We're making an unwarranted assumption | ||
332 | // about the size of t. This needs to be fixed properly. | ||
333 | m_log.ErrorFormat("[SCRIPT ENGINE]: Error line number conversion exception {0}", e2); | ||
334 | line = " at line (unavailable)"; | ||
335 | } | ||
336 | |||
337 | break; | ||
338 | } | ||
339 | } | ||
340 | } | ||
341 | text += e.InnerException.Message.ToString() + line; | 311 | text += e.InnerException.Message.ToString() + line; |
342 | } | 312 | } |
343 | else | 313 | else |