stop exceptions in setting and getting state from propogating since they aren't fatal to operations

this will hopefully stop "save oar" from failing if a script asset is corrupt
0.7-release
Justin Clark-Casey (justincc) 2010-06-29 18:54:31 +01:00
parent 6f1b351cf4
commit f4b90b52db
1 changed files with 31 additions and 8 deletions

View File

@ -356,14 +356,26 @@ namespace OpenSim.Region.Framework.Scenes
m_part.ParentGroup.m_savedScriptState[oldID] = newDoc.OuterXml; m_part.ParentGroup.m_savedScriptState[oldID] = newDoc.OuterXml;
} }
foreach (IScriptModule e in engines) foreach (IScriptModule e in engines)
{ {
if (e != null) if (e != null)
{
// Stop an exception in setting saved state from propogating since this is not fatal.
try
{ {
if (e.SetXMLState(newID, m_part.ParentGroup.m_savedScriptState[oldID])) if (e.SetXMLState(newID, m_part.ParentGroup.m_savedScriptState[oldID]))
break; break;
} }
catch (Exception ex)
{
m_log.WarnFormat(
"[PRIM INVENTORY]: Could not set script state for old key {0}, new key {1} in prim {2} {3}. Exception {4}{5}",
oldID, newID, m_part.Name, m_part.UUID, ex.Message, ex.StackTrace);
} }
}
}
m_part.ParentGroup.m_savedScriptState.Remove(oldID); m_part.ParentGroup.m_savedScriptState.Remove(oldID);
} }
} }
@ -1020,6 +1032,10 @@ namespace OpenSim.Region.Framework.Scenes
foreach (IScriptModule e in engines) foreach (IScriptModule e in engines)
{ {
if (e != null) if (e != null)
{
// Stop any exception from the script engine from propogating since setting state
// isn't essential.
try
{ {
string n = e.GetXMLState(item.ItemID); string n = e.GetXMLState(item.ItemID);
if (n != String.Empty) if (n != String.Empty)
@ -1029,6 +1045,13 @@ namespace OpenSim.Region.Framework.Scenes
break; break;
} }
} }
catch (Exception ex)
{
m_log.WarnFormat(
"[PRIM INVENTORY]: Could not retrieve script state for item {0} {1} in prim {2} {3}. Exception {4}{5}",
item.Name, item.ItemID, m_part.Name, m_part.UUID, ex.Message, ex.StackTrace);
}
}
} }
} }
} }