From 6596360a16f0a669b0f7a9e1b02f64310f724581 Mon Sep 17 00:00:00 2001 From: Hayden Ball Date: Mon, 7 May 2018 03:30:49 +0100 Subject: [PATCH] Include Cocaine error when there was an error processing thumbnails (#2415) --- lib/paperclip/thumbnail.rb | 5 ++++- spec/paperclip/thumbnail_spec.rb | 8 +++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/paperclip/thumbnail.rb b/lib/paperclip/thumbnail.rb index fee246a93..8a3af14d3 100644 --- a/lib/paperclip/thumbnail.rb +++ b/lib/paperclip/thumbnail.rb @@ -85,7 +85,10 @@ def make dest: File.expand_path(dst.path), ) rescue Terrapin::ExitStatusError => e - raise Paperclip::Error, "There was an error processing the thumbnail for #{@basename}" if @whiny + if @whiny + message = "There was an error processing the thumbnail for #{@basename}:\n" + e.message + raise Paperclip::Error, message + end rescue Terrapin::CommandNotFoundError => e raise Paperclip::Errors::CommandNotFoundError.new("Could not run the `convert` command. Please install ImageMagick.") end diff --git a/spec/paperclip/thumbnail_spec.rb b/spec/paperclip/thumbnail_spec.rb index 03c8c1e08..aa42b993e 100644 --- a/spec/paperclip/thumbnail_spec.rb +++ b/spec/paperclip/thumbnail_spec.rb @@ -179,10 +179,12 @@ end it "errors when trying to create the thumbnail" do - assert_raises(Paperclip::Error) do - silence_stream(STDERR) do + silence_stream(STDERR) do + expect { @thumb.make - end + }.to raise_error( + Paperclip::Error, /unrecognized option `-this-aint-no-option'/ + ) end end