Skip to content

Commit

Permalink
Adds Restclient missing exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
sachin-sandhu committed Feb 5, 2025
1 parent a5591fc commit 2bf11cd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
3 changes: 2 additions & 1 deletion docker/lib/dependabot/docker/update_checker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,8 @@ def tags_from_registry
raise if using_dockerhub?

raise PrivateSourceTimedOut, registry_hostname
rescue RestClient::ServerBrokeConnection
rescue RestClient::ServerBrokeConnection,
RestClient::TooManyRequests
raise PrivateSourceBadResponse, registry_hostname
end

Expand Down
12 changes: 12 additions & 0 deletions docker/spec/dependabot/docker/update_checker_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,18 @@ def stub_tag_with_no_digest(tag)
.to raise_error(Dependabot::PrivateSourceBadResponse)
end
end

context "when TooManyRequests request error" do
before do
stub_request(:get, repo_url + "tags/list")
.to_raise(RestClient::TooManyRequests)
end

it "raises" do
expect { checker.latest_version }
.to raise_error(Dependabot::PrivateSourceBadResponse)
end
end
end

context "when the dependency's version has a suffix" do
Expand Down

0 comments on commit 2bf11cd

Please sign in to comment.