From 538ff31b284298083bdb0c6c998e4bae9a369f98 Mon Sep 17 00:00:00 2001 From: Oren Hurvitz Date: Mon, 21 Apr 2014 09:01:42 +0300 Subject: Better error handling when retrieving offline IMs --- .../Addons/OfflineIM/Remote/OfflineIMServiceRemoteConnector.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'OpenSim/Addons') diff --git a/OpenSim/Addons/OfflineIM/Remote/OfflineIMServiceRemoteConnector.cs b/OpenSim/Addons/OfflineIM/Remote/OfflineIMServiceRemoteConnector.cs index f6b17e5..eb287a4 100644 --- a/OpenSim/Addons/OfflineIM/Remote/OfflineIMServiceRemoteConnector.cs +++ b/OpenSim/Addons/OfflineIM/Remote/OfflineIMServiceRemoteConnector.cs @@ -82,8 +82,13 @@ namespace OpenSim.OfflineIM if (!ret.ContainsKey("RESULT")) 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; + } foreach (object v in ((Dictionary)ret["RESULT"]).Values) { @@ -110,7 +115,7 @@ namespace OpenSim.OfflineIM string result = ret["RESULT"].ToString(); if (result == "NULL" || result.ToLower() == "false") { - reason = ret["REASON"].ToString(); + reason = ret.ContainsKey("REASON") ? ret["REASON"].ToString() : "Unknown error"; return false; } -- cgit v1.1