-
Notifications
You must be signed in to change notification settings - Fork 24
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
Introduce bang methods which raise exceptions when API returns errors #25
base: master
Are you sure you want to change the base?
Conversation
Basically I believe there is no reason to keep both ways, i.e. when is it really necessary not to throw an exception if a request isn't successul? |
@main24, the first thing which comes to my mind is doing several requests in the loop, or several threads. For example,
This would be much harder to process if we do it via catching exceptions. Although, having |
5607c08
to
b37992e
Compare
@main24 , I've added deprication warning to the regular methods. Please, take a look |
54c77bd
to
270c3f2
Compare
README.markdown
Outdated
c.user_agent = 'My Seller Tool/2.0 (Language=Ruby/2.5.5)' | ||
end | ||
``` | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's unrelated to the PR, please extract it into separate commit.
lib/mws/api/base.rb
Outdated
@@ -43,19 +44,40 @@ def build_query_from_params(action, params) | |||
|
|||
def method_missing(name, *args) | |||
if self.class::ACTIONS.include?(name) | |||
warn "[DEPRECATION] `#{name}` will be removed in next major version. " \ | |||
"Please use `#{name}!` instead." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Basically we're not going to get rid of methods without bang, but will change their behavior to the same as ones with bang – they'll be raising exceptions.
1f40e50
to
4f11454
Compare
e.g.: mws_api.subscriptions.register_destination!(...) Deprecate old methods (with no bangs) Update documentation
e.g.: mws_api.subscriptions.register_destination!(...)