Better error handling if Load OAR or Save OAR fail

0.7.4.1
Oren Hurvitz 2012-04-29 08:53:33 +03:00 committed by Justin Clark-Casey (justincc)
parent a82dc263ab
commit 65c88b2ff4
3 changed files with 32 additions and 6 deletions

View File

@ -200,8 +200,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver
}
catch (Exception e)
{
m_log.ErrorFormat(
"[ARCHIVER]: Aborting load with error in archive file {0}. {1}", filePath, e);
m_log.Error(
String.Format("[ARCHIVER]: Aborting load with error in archive file {0} ", filePath), e);
m_errorMessage += e.ToString();
m_scene.EventManager.TriggerOarFileLoaded(m_requestId, m_errorMessage);
return;
@ -219,6 +219,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
{
m_log.ErrorFormat("[ARCHIVER]: Failed to load {0} assets", failedAssetRestores);
m_errorMessage += String.Format("Failed to load {0} assets", failedAssetRestores);
// Continue, because we allow the OAR to be loaded even if some assets fail
}
}
@ -228,8 +229,19 @@ namespace OpenSim.Region.CoreModules.World.Archiver
m_scene.DeleteAllSceneObjects();
}
LoadParcels(serialisedParcels);
LoadObjects(serialisedSceneObjects);
try
{
LoadParcels(serialisedParcels);
LoadObjects(serialisedSceneObjects);
}
catch (Exception e)
{
m_log.Error("[ARCHIVER]: Error loading parcels or objects ", e);
m_errorMessage += e.ToString();
m_scene.EventManager.TriggerOarFileLoaded(m_requestId, m_errorMessage);
return;
}
m_log.InfoFormat("[ARCHIVER]: Successfully loaded archive");

View File

@ -87,6 +87,11 @@ namespace OpenSim.Region.CoreModules.World.Archiver
{
Save(assetsFoundUuids, assetsNotFoundUuids);
}
catch (Exception e)
{
m_scene.EventManager.TriggerOarFileSaved(m_requestId, e.ToString());
throw;
}
finally
{
m_archiveWriter.Close();
@ -150,4 +155,4 @@ namespace OpenSim.Region.CoreModules.World.Archiver
}
}
}
}
}

View File

@ -124,6 +124,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver
if (options.ContainsKey("noassets") && (bool)options["noassets"])
SaveAssets = false;
// Whether someone else (i.e., ReceivedAllAssets()) is responsible for calling TriggerOarFileSaved() when we're done
bool eventHandled = false;
try
{
Dictionary<UUID, AssetType> assetUuids = new Dictionary<UUID, AssetType>();
@ -230,15 +233,21 @@ namespace OpenSim.Region.CoreModules.World.Archiver
m_scene.RegionInfo.ScopeID, options, awre.ReceivedAllAssets);
Util.FireAndForget(o => ar.Execute());
eventHandled = true;
}
else
{
awre.ReceivedAllAssets(new List<UUID>(), new List<UUID>());
eventHandled = true;
}
}
catch (Exception)
catch (Exception e)
{
m_saveStream.Close();
if (!eventHandled)
m_scene.EventManager.TriggerOarFileSaved(m_requestId, e.ToString());
throw;
}
}