Skip to content

Commit 6596360

Browse files
ball-haydensidraval
authored andcommitted
Include Cocaine error when there was an error processing thumbnails (thoughtbot#2415)
1 parent d7251af commit 6596360

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

lib/paperclip/thumbnail.rb

+4-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,10 @@ def make
8585
dest: File.expand_path(dst.path),
8686
)
8787
rescue Terrapin::ExitStatusError => e
88-
raise Paperclip::Error, "There was an error processing the thumbnail for #{@basename}" if @whiny
88+
if @whiny
89+
message = "There was an error processing the thumbnail for #{@basename}:\n" + e.message
90+
raise Paperclip::Error, message
91+
end
8992
rescue Terrapin::CommandNotFoundError => e
9093
raise Paperclip::Errors::CommandNotFoundError.new("Could not run the `convert` command. Please install ImageMagick.")
9194
end

spec/paperclip/thumbnail_spec.rb

+5-3
Original file line numberDiff line numberDiff line change
@@ -179,10 +179,12 @@
179179
end
180180

181181
it "errors when trying to create the thumbnail" do
182-
assert_raises(Paperclip::Error) do
183-
silence_stream(STDERR) do
182+
silence_stream(STDERR) do
183+
expect {
184184
@thumb.make
185-
end
185+
}.to raise_error(
186+
Paperclip::Error, /unrecognized option `-this-aint-no-option'/
187+
)
186188
end
187189
end
188190

0 commit comments

Comments
 (0)