Skip to content

Commit

Permalink
Adds handler for serverconnection errors (#11488)
Browse files Browse the repository at this point in the history
  • Loading branch information
sachin-sandhu authored Feb 5, 2025
1 parent 8e77d0b commit c63362f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docker/lib/dependabot/docker/update_checker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,8 @@ def tags_from_registry
raise if using_dockerhub?

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

def latest_digest
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 @@ -511,6 +511,18 @@ def stub_tag_with_no_digest(tag)
end
end
end

context "when there is ServerBrokeConnection error response" do
before do
stub_request(:get, repo_url + "tags/list")
.to_raise(RestClient::ServerBrokeConnection)
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 c63362f

Please sign in to comment.