From b36b408bb7ebf7255ae7d8443ef211a15f72522a Mon Sep 17 00:00:00 2001 From: Gabe Blair Date: Thu, 21 Mar 2024 09:04:08 -0700 Subject: [PATCH] Add actual IM error to output when failing to process --- lib/carrierwave/processing/mini_magick.rb | 4 ++-- lib/carrierwave/processing/rmagick.rb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/carrierwave/processing/mini_magick.rb b/lib/carrierwave/processing/mini_magick.rb index f37be9879..674c45472 100644 --- a/lib/carrierwave/processing/mini_magick.rb +++ b/lib/carrierwave/processing/mini_magick.rb @@ -266,7 +266,7 @@ def manipulate! rescue ::MiniMagick::Error, ::MiniMagick::Invalid => e raise e if e.message =~ /(You must have .+ installed|is not installed|executable not found)/ message = I18n.translate(:"errors.messages.processing_error") - raise CarrierWave::ProcessingError, message + raise CarrierWave::ProcessingError, "#{message}: #{e.message}" ensure image.destroy! if image end @@ -313,7 +313,7 @@ def minimagick!(block = nil) rescue ::MiniMagick::Error, ::MiniMagick::Invalid => e raise e if e.message =~ /(You must have .+ installed|is not installed|executable not found)/ message = I18n.translate(:"errors.messages.processing_error") - raise CarrierWave::ProcessingError, message + raise CarrierWave::ProcessingError, "#{message}: #{e.message}" end private diff --git a/lib/carrierwave/processing/rmagick.rb b/lib/carrierwave/processing/rmagick.rb index 311b45984..d6c255b61 100644 --- a/lib/carrierwave/processing/rmagick.rb +++ b/lib/carrierwave/processing/rmagick.rb @@ -366,8 +366,8 @@ def manipulate!(options={}, &block) end destroy_image(frames) - rescue ::Magick::ImageMagickError - raise CarrierWave::ProcessingError, I18n.translate(:"errors.messages.processing_error") + rescue ::Magick::ImageMagickError => e + raise CarrierWave::ProcessingError, I18n.translate(:"errors.messages.processing_error") + ": #{e.message}" end private