TC-88: Catching and reporting exceptions from commands instead of hanging

Patch by Mimika Oh.

git-svn-id: http://libopenmetaverse.googlecode.com/svn/libopenmetaverse/trunk@3483 52acb1d6-8a22-11de-b505-999d5b087335
This commit is contained in:
Latif Khalifa
2011-03-14 15:20:11 +00:00
parent eac29282bb
commit 22b72d7680

View File

@@ -341,10 +341,17 @@ namespace OpenMetaverse.TestClient
{
TestClient testClient = (TestClient)state;
if ((String.Empty == onlyAvatar) || (testClient.ToString() == onlyAvatar)) {
if (testClient.Commands.ContainsKey(firstToken))
Logger.Log(testClient.Commands[firstToken].Execute(args, fromAgentID),
Helpers.LogLevel.Info, testClient);
else
if (testClient.Commands.ContainsKey(firstToken)) {
string result;
try {
result = testClient.Commands[firstToken].Execute(args, fromAgentID);
Logger.Log(result, Helpers.LogLevel.Info, testClient);
} catch(Exception e) {
Logger.Log(String.Format("{0} raised exception {1}", firstToken, e),
Helpers.LogLevel.Error,
testClient);
}
} else
Logger.Log("Unknown command " + firstToken, Helpers.LogLevel.Warning);
}