Skip to content

Conversation

@mrbox
Copy link

@mrbox mrbox commented Mar 14, 2017

It's copy&paste from #50 but including the change requested in PR

  • I've read and understood the Contributing guidelines and have done my best effort to follow them.
  • I've read and agree to the Code of Conduct.
  • I've been mindful about doing atomic commits, adding documentation to my changes, not refactoring too much.
  • I've a descriptive title and added any useful information for the reviewer. Where appropriate, I've attached a screenshot and/or screencast (gif preferably).
  • I've written tests to cover the new code and functionality included in this PR.
  • I've read, agree to, and signed the Contributor License Agreement (CLA).

PR Summary

Add possibility to re-raise exceptions happening when connecting to Slack RTM api

It's copy&paste from slackapi#50 but including the change requested in PR
@CLAassistant
Copy link

CLAassistant commented Mar 14, 2017

CLA assistant check
Thank you for your submission, we really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@codecov
Copy link

codecov bot commented Mar 14, 2017

Codecov Report

Merging #175 into master will decrease coverage by 0.43%.
The diff coverage is 33.33%.

@@            Coverage Diff             @@
##           master     #175      +/-   ##
==========================================
- Coverage   64.16%   63.72%   -0.44%     
==========================================
  Files           9        9              
  Lines         293      295       +2     
==========================================
  Hits          188      188              
- Misses        105      107       +2
Impacted Files Coverage Δ
slackclient/_client.py 41.07% <33.33%> (-1.53%)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9d0ad91...64dbd6d. Read the comment docs.

@JustinAzoff
Copy link

This looks like a helpful change, but I would argue that the exception swallowing code in this function should simply be removed.

Looking at how this function is used:

https://github.com/search?l=Python&p=1&q=rtm_connect&type=Code&utf8=%E2%9C%93

I see two common patterns:

  1. rtm_connect is called, and the return value is ignored.
  2. rtm_connect is called, and if it does not return true, the program silently does nothing or an error message is printed.

In the first case, I'm not sure what happens when something like rtm_send_message is called immediately after that.

In the 2nd case, I see people doing various things like

print "Connection failed"
print "Connection Failed, invalid token?"
raise ConnectionError
raise Exception('Connection failed, invalid token ?')

In every single one of these cases this is a less helpful, and possibly completely misleading error message.

Yes, raising the exception by default would change the api, but as far as I can tell every single program that uses this library is already broken due to this exception swallowing.

@Roach
Copy link
Contributor

Roach commented Oct 3, 2017

We plan to refactor much of this library's error handling as part of an upcoming quality SDK project. As such, I'm going to close this in favor of removing the error suppression issues and cleaning up the exception logic.

@Roach Roach closed this Oct 3, 2017
@Roach Roach added this to the 1.x milestone Dec 2, 2017
@Roach Roach added the RTM label Dec 2, 2017
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.

4 participants