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) catch (Exception e)
{ {
m_log.ErrorFormat( m_log.Error(
"[ARCHIVER]: Aborting load with error in archive file {0}. {1}", filePath, e); String.Format("[ARCHIVER]: Aborting load with error in archive file {0} ", filePath), e);
m_errorMessage += e.ToString(); m_errorMessage += e.ToString();
m_scene.EventManager.TriggerOarFileLoaded(m_requestId, m_errorMessage); m_scene.EventManager.TriggerOarFileLoaded(m_requestId, m_errorMessage);
return; return;
@ -219,6 +219,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
{ {
m_log.ErrorFormat("[ARCHIVER]: Failed to load {0} assets", failedAssetRestores); m_log.ErrorFormat("[ARCHIVER]: Failed to load {0} assets", failedAssetRestores);
m_errorMessage += String.Format("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(); m_scene.DeleteAllSceneObjects();
} }
LoadParcels(serialisedParcels); try
LoadObjects(serialisedSceneObjects); {
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"); m_log.InfoFormat("[ARCHIVER]: Successfully loaded archive");

View File

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

View File

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