Better error handling when retrieving offline IMs

0.8.0.3
Oren Hurvitz 2014-04-21 09:01:42 +03:00
parent 06db136fbc
commit 538ff31b28
1 changed files with 7 additions and 2 deletions

View File

@ -82,8 +82,13 @@ namespace OpenSim.OfflineIM
if (!ret.ContainsKey("RESULT")) if (!ret.ContainsKey("RESULT"))
return ims; return ims;
if (ret["RESULT"].ToString() == "NULL") string result = ret["RESULT"].ToString();
if (result == "NULL" || result.ToLower() == "false")
{
string reason = ret.ContainsKey("REASON") ? ret["REASON"].ToString() : "Unknown error";
m_log.DebugFormat("[OfflineIM.V2.RemoteConnector]: GetMessages for {0} failed: {1}", principalID, reason);
return ims; return ims;
}
foreach (object v in ((Dictionary<string, object>)ret["RESULT"]).Values) foreach (object v in ((Dictionary<string, object>)ret["RESULT"]).Values)
{ {
@ -110,7 +115,7 @@ namespace OpenSim.OfflineIM
string result = ret["RESULT"].ToString(); string result = ret["RESULT"].ToString();
if (result == "NULL" || result.ToLower() == "false") if (result == "NULL" || result.ToLower() == "false")
{ {
reason = ret["REASON"].ToString(); reason = ret.ContainsKey("REASON") ? ret["REASON"].ToString() : "Unknown error";
return false; return false;
} }