8000 Create dummy clients which will throw an exception when instantiated · Pull Request #386 · twilio/twilio-python · GitHub
[go: up one dir, main page]

Skip to content

Create dummy clients which will throw an exception when instantiated #386

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 5 commits into from
Aug 18, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
converted warnings to exceptions
  • Loading branch information
Tom Connors committed Aug 18, 2017
commit f404a05979544e4426b800974077629c6544e936
10 changes: 4 additions & 6 deletions twilio/base/obsolete.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import functools


class ObsoleteWarning(Warning):
class ObsoleteException(BaseException):
""" Base class for warnings about obsolete features. """
pass

Expand All @@ -14,11 +14,9 @@ def obsolete_client(func):

@functools.wraps(func)
def new_func(*args, **kwargs):
warnings.simplefilter('error', ObsoleteWarning)
warnings.warn("{} has been removed from this version of the library. "
"Please refer to current documentation for guidance."
.format(func.__name__),
category=ObsoleteWarning)
raise ObsoleteException("{} has been removed from this version of the library. "
"Please refer to current documentation for guidance."
.format(func.__name__))
return func(*args, **kwargs)
Copy link
Contributor

Choose a reason for hiding this comment

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

No need for return here.


return new_func
0