change display and log of normal script errors

melanie
UbitUmarov 2016-11-08 13:39:49 +00:00
parent 6218913345
commit 6c44dceced
1 changed files with 44 additions and 17 deletions

View File

@ -924,26 +924,53 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
{ {
try try
{ {
// DISPLAY ERROR INWORLD
string text = FormatException(e);
if (text.Length > 1000) if(e.InnerException != null && e.InnerException is ScriptException)
text = text.Substring(0, 1000); {
Engine.World.SimChat(Utils.StringToBytes(text), string text = e.InnerException.Message +
ChatTypeEnum.DebugChannel, 2147483647, "(script: " + ScriptName +
Part.AbsolutePosition, " event: " + data.EventName +
Part.Name, Part.UUID, false); " at " + Part.AbsolutePosition + ")";
if (text.Length > 1000)
text = text.Substring(0, 1000);
Engine.World.SimChat(Utils.StringToBytes(text),
ChatTypeEnum.DebugChannel, 2147483647,
Part.AbsolutePosition,
Part.Name, Part.UUID, false);
m_log.Debug(string.Format(
"[SCRIPT INSTANCE]: {0} (at event {1}, part {2} {3} at {4} in {5}",
e.InnerException.Message,
data.EventName,
PrimName,
Part.UUID,
Part.AbsolutePosition,
Part.ParentGroup.Scene.Name));
}
else
{
// DISPLAY ERROR INWORLD
string text = FormatException(e);
if (text.Length > 1000)
text = text.Substring(0, 1000);
Engine.World.SimChat(Utils.StringToBytes(text),
ChatTypeEnum.DebugChannel, 2147483647,
Part.AbsolutePosition,
Part.Name, Part.UUID, false);
m_log.Debug(string.Format( m_log.Debug(string.Format(
"[SCRIPT INSTANCE]: Runtime error in script {0} (event {1}), part {2} {3} at {4} in {5} ", "[SCRIPT INSTANCE]: Runtime error in script {0} (event {1}), part {2} {3} at {4} in {5} ",
ScriptName, ScriptName,
data.EventName, data.EventName,
PrimName, PrimName,
Part.UUID, Part.UUID,
Part.AbsolutePosition, Part.AbsolutePosition,
Part.ParentGroup.Scene.Name), Part.ParentGroup.Scene.Name),
e); e);
}
} }
catch (Exception) catch (Exception)
{ {