Leonidas-from-XIV / slacko

A neat interface for Slack
https://leonidas-from-xiv.github.io/slacko
Other
81 stars 11 forks source link

Stop masking errors in channel lookups #20

Closed jerith closed 7 years ago

jerith commented 7 years ago

Currently, any API call that requires a channel (or a group or a user) starts by making a lookup call. In this call, any failure response is silently replaced with channel_not_found (or user_not_found) which leads to much confusion when trying to figure out why something isn't working.

For lookupk to pass through all the errors it gets without running into type trouble, all the list functions it's passed must have the same set of errors in their return types. I checked slack's API documentation to see if groups_list actual needs the bot_error in its signature. Both https://api.slack.com/methods/groups.list and https://api.slack.com/bot-users indicate that it doesn't, so I removed it. (I did the same for im_list even it isn't used with lookupk, because it probably should be at some point.)

There's probably some more cleanup that could be done here, but I didn't want to change too much before getting a review. :-)