Rework the client error handling

This commit is contained in:
Chunting Gu
2019-06-10 12:00:57 +08:00
parent c2a009f68a
commit 8c09189b14
16 changed files with 158 additions and 199 deletions
+2 -2
View File
@@ -58,8 +58,8 @@ int main() {
#endif // WEBCC_ENABLE_SSL
} catch (const webcc::Exception& e) {
std::cout << "Exception: " << e.what() << std::endl;
} catch (const webcc::Error& error) {
std::cout << error << std::endl;
}
return 0;
+2 -2
View File
@@ -58,8 +58,8 @@ int main(int argc, char* argv[]) {
std::cout << r->status() << std::endl;
} catch (const webcc::Exception& e) {
std::cout << "Exception: " << e.what() << std::endl;
} catch (const webcc::Error& error) {
std::cout << error << std::endl;
}
return 0;
+1 -1
View File
@@ -55,7 +55,7 @@ int main(int argc, char* argv[]) {
server.Run();
} catch (const std::exception& e) {
std::cerr << "Exception: " << e.what() << std::endl;
std::cerr << e.what() << std::endl;
return 1;
}
+8 -8
View File
@@ -67,8 +67,8 @@ void ListEvents(webcc::ClientSession& session) {
PRINT_JSON_STRING(r->content());
} catch (const webcc::Exception& e) {
std::cout << e.what() << std::endl;
} catch (const webcc::Error& error) {
std::cout << error << std::endl;
}
}
@@ -81,8 +81,8 @@ void ListUserFollowers(webcc::ClientSession& session, const std::string& user) {
PRINT_JSON_STRING(r->content());
} catch (const webcc::Exception& e) {
std::cout << e.what() << std::endl;
} catch (const webcc::Error& error) {
std::cout << error << std::endl;
}
}
@@ -100,8 +100,8 @@ void ListAuthUserFollowers(webcc::ClientSession& session,
PRINT_JSON_STRING(r->content());
} catch (const webcc::Exception& e) {
std::cout << e.what() << std::endl;
} catch (const webcc::Error& error) {
std::cout << error << std::endl;
}
}
@@ -124,8 +124,8 @@ void CreateAuthorization(webcc::ClientSession& session,
std::cout << r->content() << std::endl;
} catch (const webcc::Exception& e) {
std::cout << e.what() << std::endl;
} catch (const webcc::Error& error) {
std::cout << error << std::endl;
}
}
+10 -10
View File
@@ -74,8 +74,8 @@ public:
return true;
} catch (const webcc::Exception& e) {
std::cerr << e.what() << std::endl;
} catch (const webcc::Error& error) {
std::cerr << error << std::endl;
return false;
}
}
@@ -97,8 +97,8 @@ public:
return !id->empty();
} catch (const webcc::Exception& e) {
std::cerr << e.what() << std::endl;
} catch (const webcc::Error& error) {
std::cerr << error << std::endl;
return false;
}
}
@@ -122,8 +122,8 @@ public:
return JsonStringToBook(r->content(), book);
} catch (const webcc::Exception& e) {
std::cerr << e.what() << std::endl;
} catch (const webcc::Error& error) {
std::cerr << error << std::endl;
return false;
}
}
@@ -143,8 +143,8 @@ public:
return true;
} catch (const webcc::Exception& e) {
std::cerr << e.what() << std::endl;
} catch (const webcc::Error& error) {
std::cerr << error << std::endl;
return false;
}
}
@@ -159,8 +159,8 @@ public:
return true;
} catch (const webcc::Exception& e) {
std::cerr << e.what() << std::endl;
} catch (const webcc::Error& error) {
std::cerr << error << std::endl;
return false;
}
}
+1 -1
View File
@@ -238,7 +238,7 @@ int main(int argc, char* argv[]) {
server.Run();
} catch (const std::exception& e) {
std::cerr << "Exception: " << e.what() << std::endl;
std::cerr << e.what() << std::endl;
return 1;
}