Skip to content

Commit e56c44a

Browse files
Fix swallowing original error message in git_retry (#573)
1 parent aa5fa55 commit e56c44a

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

spec/integration/install_spec.cr

+8
Original file line numberDiff line numberDiff line change
@@ -1266,4 +1266,12 @@ describe "install" do
12661266
end
12671267
end
12681268
end
1269+
1270+
it "fails when git is missing" do
1271+
metadata = {dependencies: {web: "*"}}
1272+
with_shard(metadata) do
1273+
ex = expect_raises(FailedCommand) { run "shards install --no-color", env: {"PATH" => File.expand_path("../../bin", __DIR__), "SHARDS_CACHE_PATH" => ""} }
1274+
ex.stdout.should contain "Error missing git command line tool. Please install Git first!"
1275+
end
1276+
end
12691277
end

src/resolvers/git.cr

+3-2
Original file line numberDiff line numberDiff line change
@@ -332,10 +332,11 @@ module Shards
332332
loop do
333333
yield
334334
break
335-
rescue Error
335+
rescue inner_err : Error
336336
retries += 1
337337
next if retries < 3
338-
raise Error.new(err)
338+
Log.debug { inner_err }
339+
raise Error.new("#{err}: #{inner_err}")
339340
end
340341
end
341342

0 commit comments

Comments
 (0)