From d6519924ba096c569294aa6653e6720629002f8e Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Fri, 13 Jun 2008 18:04:01 +0000 Subject: * refactor: catch asset service request exceptions at the AssetServerBase level rather than in the GridAssetClient * this is to enable logging of asset request exceptions soon --- .../Communications/Cache/GridAssetClient.cs | 38 +++++++++------------- 1 file changed, 15 insertions(+), 23 deletions(-) (limited to 'OpenSim/Framework/Communications/Cache/GridAssetClient.cs') diff --git a/OpenSim/Framework/Communications/Cache/GridAssetClient.cs b/OpenSim/Framework/Communications/Cache/GridAssetClient.cs index 4b4ef17..7787805 100644 --- a/OpenSim/Framework/Communications/Cache/GridAssetClient.cs +++ b/OpenSim/Framework/Communications/Cache/GridAssetClient.cs @@ -49,38 +49,30 @@ namespace OpenSim.Framework.Communications.Cache protected override AssetBase GetAsset(AssetRequest req) { - Stream s = null; - try - { - #if DEBUG - //m_log.DebugFormat("[GRID ASSET CLIENT]: Querying for {0}", req.AssetID.ToString()); - #endif + #if DEBUG + //m_log.DebugFormat("[GRID ASSET CLIENT]: Querying for {0}", req.AssetID.ToString()); + #endif - RestClient rc = new RestClient(_assetServerUrl); - rc.AddResourcePath("assets"); - rc.AddResourcePath(req.AssetID.ToString()); - if (req.IsTexture) - rc.AddQueryParameter("texture"); + RestClient rc = new RestClient(_assetServerUrl); + rc.AddResourcePath("assets"); + rc.AddResourcePath(req.AssetID.ToString()); + if (req.IsTexture) + rc.AddQueryParameter("texture"); - rc.RequestMethod = "GET"; - s = rc.Request(); + rc.RequestMethod = "GET"; + + Stream s = rc.Request(); - if (s.Length > 0) - { - XmlSerializer xs = new XmlSerializer(typeof (AssetBase)); - - return (AssetBase) xs.Deserialize(s); - } - } - catch (Exception e) + if (s.Length > 0) { - m_log.ErrorFormat("[GRID ASSET CLIENT]: Failed to get asset {0}, {1}", req.AssetID, e); + XmlSerializer xs = new XmlSerializer(typeof (AssetBase)); + + return (AssetBase) xs.Deserialize(s); } return null; } - public override void UpdateAsset(AssetBase asset) { throw new Exception("The method or operation is not implemented."); -- cgit v1.1