From a8c141c1440a079abc9820c83bb7da9a0698df8e Mon Sep 17 00:00:00 2001 From: jacob1 Date: Sat, 10 Oct 2015 17:39:47 -0400 Subject: [PATCH] show more specific error when catching json exceptions --- src/client/Client.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/client/Client.cpp b/src/client/Client.cpp index aac9d494fc..1b72f9c249 100644 --- a/src/client/Client.cpp +++ b/src/client/Client.cpp @@ -729,7 +729,7 @@ RequestStatus Client::ParseServerReturn(char *result, int status, bool json) lastError = httperror.str(); return RequestFailure; } - lastError = "Could not read response"; + lastError = std::string("Could not read response: ") + e.what(); return RequestFailure; } } @@ -1439,7 +1439,7 @@ LoginStatus Client::Login(std::string username, std::string password, User & use } catch (json::Exception &e) { - lastError = "Could not read response"; + lastError = std::string("Could not read response: ") + e.what(); return LoginError; } } @@ -1670,7 +1670,7 @@ SaveInfo * Client::GetSave(int saveID, int saveDate) } catch (json::Exception &e) { - lastError = "Could not read response"; + lastError = std::string("Could not read response: ") + e.what(); free(data); return NULL; } @@ -1842,7 +1842,7 @@ std::vector > * Client::GetTags(int start, int count } catch (json::Exception &e) { - lastError = "Could not read response"; + lastError = std::string("Could not read response: ") + e.what(); } } else @@ -1925,7 +1925,7 @@ std::vector * Client::SearchSaves(int start, int count, std::string q } catch (json::Exception &e) { - lastError = "Could not read response"; + lastError = std::string("Could not read response: ") + e.what(); } } free(data); @@ -1985,7 +1985,7 @@ std::list * Client::RemoveTag(int saveID, std::string tag) } catch (json::Exception &e) { - lastError = "Could not read response"; + lastError = std::string("Could not read response: ") + e.what(); } } free(data); @@ -2031,7 +2031,7 @@ std::list * Client::AddTag(int saveID, std::string tag) } catch (json::Exception &e) { - lastError = "Could not read response"; + lastError = std::string("Could not read response: ") + e.what(); } } free(data);