-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Emit user-catchable exceptions instead of just ValueError where possi…
…ble (Closes: #45)
- Loading branch information
Showing
2 changed files
with
50 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
class SlackException(ValueError): | ||
pass | ||
|
||
class ChannelNotFound(SlackException): | ||
pass | ||
|
||
class IsArchived(SlackException): | ||
pass | ||
|
||
class MsgTooLong(SlackException): | ||
pass | ||
|
||
class NoText(SlackException): | ||
pass | ||
|
||
class RateLimited(SlackException): | ||
pass | ||
|
||
class NotAuthed(SlackException): | ||
pass | ||
|
||
class InvalidAuth(SlackException): | ||
pass | ||
|
||
class TokenRevoked(SlackException): | ||
pass | ||
|
||
class AccountInactive(SlackException): | ||
pass | ||
|
||
class UserIsBot(SlackException): | ||
pass | ||
|
||
LABEL_TO_EXCEPTION = { | ||
'channel_not_found': ChannelNotFound, | ||
'is_archived': IsArchived, | ||
'msg_too_long': MsgTooLong, | ||
'no_text': NoText, | ||
'rate_limited': RateLimited, | ||
'not_authed': NotAuthed, | ||
'invalid_auth': InvalidAuth, | ||
'token_revoked': TokenRevoked, | ||
'account_inactive': AccountInactive, | ||
'user_is_bot': UserIsBot, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters