From: Dr Scofield <hud@zurich.ibm.com>

some exceptional code ;-) i've added TerrainException and have modified
TerrainModule to now throw TerrainExceptions.

   cheers,
   dr scofield
0.6.0-stable
Sean Dague 2008-04-22 19:44:40 +00:00
parent 68c6b6ece3
commit a66c43d450
1 changed files with 4 additions and 6 deletions

View File

@ -179,14 +179,13 @@ namespace OpenSim.Region.Environment.Modules.Terrain
{ {
m_log.Error("[TERRAIN]: Unable to load heightmap, the " + loader.Value + m_log.Error("[TERRAIN]: Unable to load heightmap, the " + loader.Value +
" parser does not support file loading. (May be save only)"); " parser does not support file loading. (May be save only)");
throw new Exception(String.Format("unable to load heightmap: parser {0} does not support loading", loader.Value)); throw new TerrainException(String.Format("unable to load heightmap: parser {0} does not support loading", loader.Value));
} }
catch (FileNotFoundException) catch (FileNotFoundException)
{ {
m_log.Error( m_log.Error(
"[TERRAIN]: Unable to load heightmap, file not found. (A directory permissions error may also cause this)"); "[TERRAIN]: Unable to load heightmap, file not found. (A directory permissions error may also cause this)");
throw new Exception(String.Format("unable to load heightmap: file {0} not found (or permissions do not allow access", throw new TerrainException(String.Format("unable to load heightmap: file {0} not found (or permissions do not allow access", filename));
filename));
} }
} }
CheckForTerrainUpdates(); CheckForTerrainUpdates();
@ -195,8 +194,7 @@ namespace OpenSim.Region.Environment.Modules.Terrain
} }
} }
m_log.Error("[TERRAIN]: Unable to load heightmap, no file loader availible for that format."); m_log.Error("[TERRAIN]: Unable to load heightmap, no file loader availible for that format.");
throw new Exception(String.Format("unable to load heightmap from file {0}: no loader available for that format", throw new TerrainException(String.Format("unable to load heightmap from file {0}: no loader available for that format", filename));
filename));
} }
/// <summary> /// <summary>
@ -219,7 +217,7 @@ namespace OpenSim.Region.Environment.Modules.Terrain
catch (NotImplementedException) catch (NotImplementedException)
{ {
m_log.Error("Unable to save to " + filename + ", saving of this file format has not been implemented."); m_log.Error("Unable to save to " + filename + ", saving of this file format has not been implemented.");
throw new Exception(String.Format("unable to save heightmap: {0}: saving of this file format not implemented")); throw new TerrainException(String.Format("unable to save heightmap: {0}: saving of this file format not implemented"));
} }
} }