Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Remove nonspecific rescue blocks.

.delete_subscription and .delete_thread_subscription where wrongly wrapped
with rescue blocks that did not rescue specific exceptions. Tests were updated
to correctly represent normal expected behaviour from the methods.
  • Loading branch information...
commit 6fc7c12f0dbf846496a2127e6a093bb4a6798d23 1 parent ff35fb2
@joeyw joeyw authored
View
6 lib/octokit/client/notifications.rb
@@ -210,11 +210,7 @@ def update_thread_subscription(thread_id, options={})
# @example
# @client.delete_thread_subscription(1)
def delete_thread_subscription(thread_id, options={})
- begin
- boolean_from_response(:delete, "notifications/threads/#{thread_id}", options)
- rescue
- false
- end
+ boolean_from_response(:delete, "notifications/threads/#{thread_id}", options)
end
end
View
6 lib/octokit/client/repositories.rb
@@ -665,11 +665,7 @@ def update_subscription(repo, options={})
# @example
# @client.delete_subscription("pengwynn/octokit")
def delete_subscription(repo, options={})
- begin
- boolean_from_response(:delete, "repos/#{Repository.new repo}/subscription", options)
- rescue
- false
- end
+ boolean_from_response(:delete, "repos/#{Repository.new repo}/subscription", options)
end
end
View
2  spec/octokit/client/notifications_spec.rb
@@ -130,7 +130,7 @@
it "returns false when subscription deletion fails" do
stub_delete("https://api.github.com/notifications/threads/1").
- to_return(:status => 500)
+ to_return(:status => 404)
result = @client.delete_thread_subscription(1)
expect(result).to be_false
end
View
2  spec/octokit/client/repositories_spec.rb
@@ -503,7 +503,7 @@
it "returns false when delete repo subscription fails" do
stub_delete("/repos/pengwynn/octokit/subscription").
- to_return(:status => 500)
+ to_return(:status => 404)
result = @client.delete_subscription("pengwynn/octokit")
expect(result).to be_false
end
Please sign in to comment.
Something went wrong with that request. Please try again.