Skip to content

Commit

Permalink
Fix swallowing original error message in git_retry (#573)
Browse files Browse the repository at this point in the history
  • Loading branch information
straight-shoota authored Mar 14, 2023
1 parent aa5fa55 commit e56c44a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
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

0 comments on commit e56c44a

Please sign in to comment.