Skip to content

Fix swallowing original error message in git_retry #573

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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions spec/integration/install_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -1266,4 +1266,12 @@ describe "install" do
end
end
end

it "fails when git is missing" do
metadata = {dependencies: {web: "*"}}
with_shard(metadata) do
ex = expect_raises(FailedCommand) { run "shards install --no-color", env: {"PATH" => File.expand_path("../../bin", __DIR__), "SHARDS_CACHE_PATH" => ""} }
ex.stdout.should contain "Error missing git command line tool. Please install Git first!"
end
end
end
5 changes: 3 additions & 2 deletions src/resolvers/git.cr
Original file line number Diff line number Diff line change
Expand Up @@ -332,10 +332,11 @@ module Shards
loop do
yield
break
rescue Error
rescue inner_err : Error
retries += 1
next if retries < 3
raise Error.new(err)
Log.debug { inner_err }
raise Error.new("#{err}: #{inner_err}")
end
end

Expand Down