Skip to content

Commit

Permalink
Adding exception handlers
Browse files Browse the repository at this point in the history
  • Loading branch information
sachin-sandhu committed Jan 10, 2025
1 parent 590e39a commit 4de1f2b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,7 @@ class PoetryErrorHandler < UpdateChecker

# server response error codes while accessing package index
SERVER_ERROR_CODES = T.let({
server500: /500 Server Error/,
server502: /502 Server Error/,
server503: /503 Server Error/,
server504: /504 Server Error/
Expand Down Expand Up @@ -409,6 +410,7 @@ def sanitize_url(url)
# rubocop:disable Metrics/PerceivedComplexity
sig { params(error: Exception).void }
def handle_poetry_error(error)
debugger
Dependabot.logger.warn(error.message)

if (msg = error.message.match(PoetryVersionResolver::INCOMPATIBLE_CONSTRAINTS) ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,22 @@
end
end

context "with private registry authentication 504 Server Error" do
let(:response) do
"Creating virtualenv pylossmap-m4-85W1Y-py3.13 in /home/dependabot/.cache/pypoetry/virtualenvs
Updating dependencies
Resolving dependencies...
500 Server Error: Internal Server Error for url: http://acc-py-repo.cern.ch:8081/repository/vr-py-releases/simple/jinja2/"
end
it "raises a helpful error" do
expect { poetry_error_handler }.to raise_error(Dependabot::InconsistentRegistryResponse) do |error|
expect(error.message)
.to include("http://acc-py-repo.cern.ch")
end
end
end

context "with private registry authentication 504 Server Error" do
let(:response) do
"Creating virtualenv alk-service-import-product-TbrdR40A-py3.8 in /home/dependabot/.cache/pypoetry/virtualenvs
Expand Down

0 comments on commit 4de1f2b

Please sign in to comment.