From e21f8d20223791bb7864e60f573a8f0c3982262f Mon Sep 17 00:00:00 2001 From: Yee Liu Date: Tue, 28 Apr 2020 23:13:20 -0400 Subject: [PATCH] issue-52, include statusText in login exception message --- client/LoginHandler.cpp | 11 +++++++++-- client/LoginHandler.h | 2 ++ pyrfa.cpp | 1 + 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/client/LoginHandler.cpp b/client/LoginHandler.cpp index 3f60773..19d4d93 100644 --- a/client/LoginHandler.cpp +++ b/client/LoginHandler.cpp @@ -17,7 +17,8 @@ _client(client), _isLoggedIn(false), _receivedLoginStatus(false), _componentLogger(componentLogger), -_log("") +_log(""), +_statusText("") { } @@ -33,7 +34,8 @@ _client(client), _isLoggedIn(false), _receivedLoginStatus(false), _componentLogger(componentLogger), -_log("") +_log(""), +_statusText("") { } @@ -183,6 +185,7 @@ void LoginHandler::processResponse( const rfa::message::RespMsg& respMsg){ { _receivedLoginStatus = true; const rfa::common::RespStatus & status = respMsg.getRespStatus(); + _statusText.append(status.getStatusText().c_str()); if (( status.getStreamState() == rfa::common::RespStatus::ClosedEnum ) || ( status.getStreamState() == rfa::common::RespStatus::ClosedRecoverEnum ) || ( respMsg.getRespStatus().getStatusCode() == rfa::common::RespStatus::NotAuthorizedEnum)) @@ -246,3 +249,7 @@ bool LoginHandler::isLoggedIn() const { bool LoginHandler::receivedLoginStatus() const { return _receivedLoginStatus; } + +rfa::common::RFA_String LoginHandler::getStatusText() const { + return _statusText; +} diff --git a/client/LoginHandler.h b/client/LoginHandler.h index 20a53ba..6475d10 100644 --- a/client/LoginHandler.h +++ b/client/LoginHandler.h @@ -24,6 +24,7 @@ class LoginHandler bool isLoggedIn() const; bool receivedLoginStatus() const; void cleanup(); + rfa::common::RFA_String getStatusText() const; rfa::common::Handle *_pLoginHandle; @@ -36,6 +37,7 @@ class LoginHandler bool _receivedLoginStatus; rfa::logger::ComponentLogger &_componentLogger; rfa::common::RFA_String _log; + rfa::common::RFA_String _statusText; }; #endif diff --git a/pyrfa.cpp b/pyrfa.cpp index d5cc63a..4fac049 100644 --- a/pyrfa.cpp +++ b/pyrfa.cpp @@ -414,6 +414,7 @@ void Pyrfa::login(object const &argv1=object(), object const &argv2=object(), ob if(!_pLoginHandler->isLoggedIn()) { _log = "[Pyrfa::login] Login failed. Please check data permission. (username: "; _log.append(_userName.c_str()); + _log.append("; statusText: " + _pLoginHandler->getStatusText()); _log.append(")"); _logError(_log.c_str()); //cleanUp();