* Added sanity checks to the SimianAssetServiceConnector so it will throw a sensible error message when it is misconfigured instead of a mysterious "Uri is empty" error

viewer-2-initial-appearance
John Hurliman 2010-09-07 13:43:36 -07:00
parent 5ca4c238e0
commit 029c954804
1 changed files with 30 additions and 0 deletions

View File

@ -116,6 +116,12 @@ namespace OpenSim.Services.Connectors.SimianGrid
public AssetBase Get(string id)
{
if (String.IsNullOrEmpty(m_serverUrl))
{
m_log.Error("[SIMIAN ASSET CONNECTOR]: No AssetServerURI configured");
throw new InvalidOperationException();
}
// Cache fetch
if (m_cache != null)
{
@ -142,6 +148,12 @@ namespace OpenSim.Services.Connectors.SimianGrid
/// <returns></returns>
public AssetMetadata GetMetadata(string id)
{
if (String.IsNullOrEmpty(m_serverUrl))
{
m_log.Error("[SIMIAN ASSET CONNECTOR]: No AssetServerURI configured");
throw new InvalidOperationException();
}
AssetMetadata metadata = null;
// Cache fetch
@ -213,6 +225,12 @@ namespace OpenSim.Services.Connectors.SimianGrid
/// <returns>True if the id was parseable, false otherwise</returns>
public bool Get(string id, Object sender, AssetRetrieved handler)
{
if (String.IsNullOrEmpty(m_serverUrl))
{
m_log.Error("[SIMIAN ASSET CONNECTOR]: No AssetServerURI configured");
throw new InvalidOperationException();
}
// Cache fetch
if (m_cache != null)
{
@ -243,6 +261,12 @@ namespace OpenSim.Services.Connectors.SimianGrid
/// <returns></returns>
public string Store(AssetBase asset)
{
if (String.IsNullOrEmpty(m_serverUrl))
{
m_log.Error("[SIMIAN ASSET CONNECTOR]: No AssetServerURI configured");
throw new InvalidOperationException();
}
bool storedInCache = false;
string errorMessage = null;
@ -375,6 +399,12 @@ namespace OpenSim.Services.Connectors.SimianGrid
/// <returns></returns>
public bool Delete(string id)
{
if (String.IsNullOrEmpty(m_serverUrl))
{
m_log.Error("[SIMIAN ASSET CONNECTOR]: No AssetServerURI configured");
throw new InvalidOperationException();
}
//string errorMessage = String.Empty;
string url = m_serverUrl + id;