FINALLY! Script compile errors now appear in the script error pane,

not in a funky debug window.
mysql-performance
Melanie 2009-12-22 09:24:01 +00:00
parent e68c7a1f23
commit 1876ce90af
5 changed files with 102 additions and 79 deletions

View File

@ -111,7 +111,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
if (emessage.StartsWith(slinfo+": "))
emessage = emessage.Substring(slinfo.Length+2);
message = String.Format("Line ({0},{1}) {2}",
message = String.Format("({0},{1}) {2}",
e.slInfo.lineNumber - 2,
e.slInfo.charPosition - 1, emessage);

View File

@ -623,7 +623,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
// The Second Life viewer's script editor begins
// countingn lines and columns at 0, so we subtract 1.
errtext += String.Format("Line ({0},{1}): {4} {2}: {3}\n",
errtext += String.Format("({0},{1}): {4} {2}: {3}\n",
lslPos.Key - 1, lslPos.Value - 1,
CompErr.ErrorNumber, text, severity);
hadErrors = true;

View File

@ -1673,7 +1673,7 @@ default
{
// The syntax error is on line 6, char 5 (expected ';', found
// '}').
Assert.AreEqual("Line (4,4) syntax error", e.Message);
Assert.AreEqual("(4,4) syntax error", e.Message);
throw;
}
}
@ -1698,7 +1698,7 @@ default
catch (System.Exception e)
{
// The syntax error is on line 5, char 14 (Syntax error)
Assert.AreEqual("Line (3,13) syntax error", e.Message);
Assert.AreEqual("(3,13) syntax error", e.Message);
throw;
}

View File

@ -967,7 +967,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
if (col == 0)
col++;
message = string.Format("Runtime error:\n" +
"Line ({0}): {1}", scriptLine - 1,
"({0}): {1}", scriptLine - 1,
e.InnerException.Message);
System.Console.WriteLine(e.ToString()+"\n");

View File

@ -77,6 +77,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
private string m_ScriptErrorMessage;
private Dictionary<string, string> m_uniqueScripts = new Dictionary<string, string>();
private bool m_AppDomainLoading;
private Dictionary<UUID,ArrayList> m_ScriptErrors =
new Dictionary<UUID,ArrayList>();
// disable warning: need to keep a reference to XEngine.EventManager
// alive to avoid it being garbage collected
@ -589,6 +591,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> linemap;
lock(m_ScriptErrors)
{
try
{
lock (m_AddingAssemblies)
@ -607,70 +611,78 @@ namespace OpenSim.Region.ScriptEngine.XEngine
{
foreach (string warning in warnings)
{
try
{
// DISPLAY WARNING INWORLD
string text = "Warning:\n" + warning;
if (text.Length > 1000)
text = text.Substring(0, 1000);
if (!ShowScriptSaveResponse(item.OwnerID,
assetID, text, true))
{
if (presence != null && (!postOnRez))
presence.ControllingClient.SendAgentAlertMessage("Script saved with warnings, check debug window!", false);
if (!m_ScriptErrors.ContainsKey(itemID))
m_ScriptErrors[itemID] = new ArrayList();
World.SimChat(Utils.StringToBytes(text),
ChatTypeEnum.DebugChannel, 2147483647,
part.AbsolutePosition,
part.Name, part.UUID, false);
}
}
catch (Exception e2) // LEGIT: User Scripting
{
m_log.Error("[XEngine]: " +
"Error displaying warning in-world: " +
e2.ToString());
m_log.Error("[XEngine]: " +
"Warning:\r\n" +
warning);
}
m_ScriptErrors[itemID].Add(warning);
// try
// {
// // DISPLAY WARNING INWORLD
// string text = "Warning:\n" + warning;
// if (text.Length > 1000)
// text = text.Substring(0, 1000);
// if (!ShowScriptSaveResponse(item.OwnerID,
// assetID, text, true))
// {
// if (presence != null && (!postOnRez))
// presence.ControllingClient.SendAgentAlertMessage("Script saved with warnings, check debug window!", false);
//
// World.SimChat(Utils.StringToBytes(text),
// ChatTypeEnum.DebugChannel, 2147483647,
// part.AbsolutePosition,
// part.Name, part.UUID, false);
// }
// }
// catch (Exception e2) // LEGIT: User Scripting
// {
// m_log.Error("[XEngine]: " +
// "Error displaying warning in-world: " +
// e2.ToString());
// m_log.Error("[XEngine]: " +
// "Warning:\r\n" +
// warning);
// }
}
}
}
catch (Exception e)
{
try
{
// try
// {
if (!m_ScriptErrors.ContainsKey(itemID))
m_ScriptErrors[itemID] = new ArrayList();
// DISPLAY ERROR INWORLD
m_ScriptErrorMessage += "Failed to compile script in object: '" + part.ParentGroup.RootPart.Name + "' Script name: '" + item.Name + "' Error message: " + e.Message.ToString();
// m_ScriptErrorMessage += "Failed to compile script in object: '" + part.ParentGroup.RootPart.Name + "' Script name: '" + item.Name + "' Error message: " + e.Message.ToString();
//
m_ScriptFailCount++;
string text = "Error compiling script '" + item.Name + "':\n" + e.Message.ToString();
if (text.Length > 1000)
text = text.Substring(0, 1000);
if (!ShowScriptSaveResponse(item.OwnerID,
assetID, text, false))
{
if (presence != null && (!postOnRez))
presence.ControllingClient.SendAgentAlertMessage("Script saved with errors, check debug window!", false);
World.SimChat(Utils.StringToBytes(text),
ChatTypeEnum.DebugChannel, 2147483647,
part.AbsolutePosition,
part.Name, part.UUID, false);
}
}
catch (Exception e2) // LEGIT: User Scripting
{
m_log.Error("[XEngine]: "+
"Error displaying error in-world: " +
e2.ToString());
m_log.Error("[XEngine]: " +
"Errormessage: Error compiling script:\r\n" +
e.Message.ToString());
}
m_ScriptErrors[itemID].Add(e.Message.ToString());
// string text = "Error compiling script '" + item.Name + "':\n" + e.Message.ToString();
// if (text.Length > 1000)
// text = text.Substring(0, 1000);
// if (!ShowScriptSaveResponse(item.OwnerID,
// assetID, text, false))
// {
// if (presence != null && (!postOnRez))
// presence.ControllingClient.SendAgentAlertMessage("Script saved with errors, check debug window!", false);
// World.SimChat(Utils.StringToBytes(text),
// ChatTypeEnum.DebugChannel, 2147483647,
// part.AbsolutePosition,
// part.Name, part.UUID, false);
// }
// }
// catch (Exception e2) // LEGIT: User Scripting
// {
// m_log.Error("[XEngine]: "+
// "Error displaying error in-world: " +
// e2.ToString());
// m_log.Error("[XEngine]: " +
// "Errormessage: Error compiling script:\r\n" +
// e.Message.ToString());
// }
return false;
}
}
lock (m_Scripts)
{
@ -1473,7 +1485,18 @@ namespace OpenSim.Region.ScriptEngine.XEngine
public ArrayList GetScriptErrors(UUID itemID)
{
System.Threading.Thread.Sleep(1000);
lock (m_ScriptErrors)
{
if (m_ScriptErrors.ContainsKey(itemID))
{
ArrayList ret = m_ScriptErrors[itemID];
m_ScriptErrors.Remove(itemID);
return ret;
}
return new ArrayList();
}
}
}
}