Skip to content

Removing redundant method in connection service. #169

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Feb 15, 2018

Conversation

MrMeemus
Copy link
Contributor

Connection service should maintain a single responsibility of supplying connection requests and handling responses. It should not output any error messages to the console as that should be the responsibility of the client (mssqlcliclient).

After reviewing the handle_connection_response method it only served as a logging/console writing function. This was discovered during bug bash that if any errors happened on the completion refresher thread, the error would be populated to the user which is not useful.

The background thread for completion refresher is allowed to fail and should not interrupt the user's session if it does.

sys.stderr.write(
u'\nIncorrect json rpc request. Connection not successful.')
return None

Copy link
Contributor

@abhisheksinha89 abhisheksinha89 Feb 15, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These output the connection error messages to the terminal. Without these the user would'nt know why the connection did not succeed if unable to connect

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I can surface error messages for the client to output to the console. For this particular error how do we know the lack of a result means the json rpc request was invalid? also this message doesn't seem to be actionable for the user since we are forming the request.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We would get back a result if toolsservice was able to understand our request. If we don't have a result parameter it means something went wrong in jsonrpc request.


In reply to: 168625939 [](ancestors = 168625939)

Copy link
Contributor

@abhisheksinha89 abhisheksinha89 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🕐

if response.error_message:
error_messages.append(u'Error message: {}'.format(response.error_message))
if response.messages:
error_messages.append(u'Additional message: {}'.format(response.messages))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not add additional messages. This has the entire call stack of SqlClient. That is why previously we just output the error and only logged the message.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated.

@abhisheksinha89
Copy link
Contributor

Did you try this with an incorrect login to see what is output to the user?

@@ -173,8 +173,6 @@ def verify_connection_service_response(self,
elif isinstance(response, connectionservice.ConnectionCompleteEvent):
if response.connection_id:
complete_event += 1
Copy link
Contributor

@abhisheksinha89 abhisheksinha89 Feb 15, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you assert the connection_id here? #Closed

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nvm


In reply to: 168636959 [](ancestors = 168636959)

Copy link
Contributor

@abhisheksinha89 abhisheksinha89 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@MrMeemus MrMeemus merged commit 0c1063d into master Feb 15, 2018
@MrMeemus MrMeemus deleted the ron/single_responsibility_connection_service branch February 15, 2018 23:13
hejack0207 pushed a commit to hejack0207/osql-cli that referenced this pull request Apr 27, 2018
* Removing redundant method in connection service.

* Updating mssqlcliclient to surface error messages to it's callers.

* Removed copyright statement in test and flake8 format.

* Converting output of stack trace to be logged instead.
hejack0207 pushed a commit to hejack0207/osql-cli that referenced this pull request Apr 27, 2018
* Removing redundant method in connection service.

* Updating mssqlcliclient to surface error messages to it's callers.

* Removed copyright statement in test and flake8 format.

* Converting output of stack trace to be logged instead.
hejack0207 pushed a commit to hejack0207/osql-cli that referenced this pull request Apr 27, 2018
* Removing redundant method in connection service.

* Updating mssqlcliclient to surface error messages to it's callers.

* Removed copyright statement in test and flake8 format.

* Converting output of stack trace to be logged instead.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants