Catch exception from notification request #4932

This commit is contained in:
Jerry (Xinyu Hou) 2015-11-12 12:05:26 -08:00
parent 8c4ccdf148
commit 4b7796d215
1 changed files with 11 additions and 3 deletions

View File

@ -30,7 +30,7 @@
#include "platform/MSWindowsSession.h" #include "platform/MSWindowsSession.h"
#endif #endif
#define JSON_URL "https://test.synergy-project.org/premium/json/" #define JSON_URL "http://test.synergy-project.org/premium/json/"
enum { enum {
kErrorOk, kErrorOk,
@ -219,9 +219,17 @@ ToolApp::notifyActivation()
ss << "&os=" << ARCH->internet().urlEncode(ARCH->getOSName()); ss << "&os=" << ARCH->internet().urlEncode(ARCH->getOSName());
ss << "&arch=" << ARCH->internet().urlEncode(ARCH->getPlatformName()); ss << "&arch=" << ARCH->internet().urlEncode(ARCH->getPlatformName());
try {
std::cout << ARCH->internet().get(ss.str()) << std::endl; std::cout << ARCH->internet().get(ss.str()) << std::endl;
} }
catch (std::exception& e) {
LOG((CLOG_CRIT "An error occurred during notification: %s\n", e.what()));
}
catch (...) {
LOG((CLOG_CRIT "An unknown error occurred during notification.\n"));
}
}
else { else {
LOG((CLOG_DEBUG "notify activation failed")); LOG((CLOG_DEBUG "notification failed"));
} }
} }