Restore "friendly errors" to the XEngine

0.6.0-stable
Melanie Thielker 2008-10-07 21:59:56 +00:00
parent 4ed6e78d1a
commit 638cce09d1
4 changed files with 23 additions and 30 deletions

View File

@ -197,13 +197,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
} }
catch (TargetInvocationException tie) catch (TargetInvocationException tie)
{ {
// Grab the inner exception and rethrow it, unless the inner // Grab the inner exception and rethrow it, unless the inner
// exception is an EventAbortException as this indicates event // exception is an EventAbortException as this indicates event
// invokation termination due to a state change. // invocation termination due to a state change.
if ( !(tie.InnerException is EventAbortException) ) // DO NOT THROW JUST THE INNER EXCEPTION!
{ // FriendlyErrors depends on getting the whole exception!
throw tie.InnerException; //
} if ( !(tie.InnerException is EventAbortException) )
{
throw tie;
}
} }
catch (Exception e) catch (Exception e)
{ {

View File

@ -99,10 +99,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
string message; string message;
// LL start numbering lines at 0 - geeks! // 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}", message = String.Format("Line ({0},{1}) {2}",
e.slInfo.lineNumber - 1, e.slInfo.lineNumber - 2,
e.slInfo.charPosition - 1, e.Message); e.slInfo.charPosition - 1, emessage);
throw new Exception(message); throw new Exception(message);
} }

View File

@ -613,27 +613,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
m_InEvent = false; m_InEvent = false;
m_CurrentEvent = String.Empty; m_CurrentEvent = String.Empty;
if (!(e is TargetInvocationException) || (!(e.InnerException is EventAbortException) && (!(e.InnerException is SelfDeleteException)))) if (!(e is TargetInvocationException) || !(e.InnerException is SelfDeleteException))
{ {
if (e is System.Threading.ThreadAbortException)
{
lock (m_EventQueue)
{
if ((m_EventQueue.Count > 0) && m_RunEvents && (!m_ShuttingDown))
{
m_CurrentResult=m_Engine.QueueEventHandler(this);
}
else
{
m_CurrentResult = null;
}
}
m_DetectParams = null;
return 0;
}
try try
{ {
// DISPLAY ERROR INWORLD // DISPLAY ERROR INWORLD

View File

@ -514,7 +514,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
try try
{ {
// DISPLAY ERROR INWORLD // DISPLAY ERROR INWORLD
string text = "Error compiling script:\n" + e.ToString(); string text = "Error compiling script:\n" + e.Message.ToString();
if (text.Length > 1000) if (text.Length > 1000)
text = text.Substring(0, 1000); text = text.Substring(0, 1000);
World.SimChat(Utils.StringToBytes(text), World.SimChat(Utils.StringToBytes(text),