Skip to content

Commit 76db9e2

Browse files
authored
Show the package name associated with shard errors (#674)
1 parent e74e050 commit 76db9e2

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

spec/integration/install_spec.cr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -855,7 +855,7 @@ describe "install" do
855855
with_shard(metadata) do
856856
ex = expect_raises(FailedCommand) { run "shards install --no-color" }
857857
ex.stdout.should contain <<-ERROR
858-
E: Could not find executable "nonexistent"
858+
E: Could not find executable "nonexistent" for "executable_missing"
859859
ERROR
860860
end
861861
end

src/cli.cr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,12 +176,12 @@ end
176176
begin
177177
Shards.run
178178
rescue ex : OptionParser::InvalidOption
179-
Shards::Log.fatal { ex.message }
179+
Shards::Log.fatal(exception: ex) { ex.message }
180180
exit 1
181181
rescue ex : Shards::ParseError
182182
ex.to_s(STDERR)
183183
exit 1
184184
rescue ex : Shards::Error
185-
Shards::Log.error { ex.message }
185+
Shards::Log.error(exception: ex) { ex.message }
186186
exit 1
187187
end

src/package.cr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ module Shards
114114
spec.executables.each do |name|
115115
exe_name = find_executable_file(Path[install_path], name)
116116
unless exe_name
117-
raise Shards::Error.new("Could not find executable #{name.inspect}")
117+
raise Shards::Error.new("Could not find executable #{name.inspect} for #{@name.inspect}")
118118
end
119119
Log.debug { "Install #{exe_name}" }
120120
source = File.join(install_path, exe_name)

0 commit comments

Comments
 (0)