Skip to content

Commit

Permalink
Merge pull request #34 from Nitrodist/allow-errors-to-bubble-up
Browse files Browse the repository at this point in the history
Allow errors to bubble up
  • Loading branch information
rheaton committed Jun 16, 2015
2 parents b2545bb + 7472b38 commit d86dc91
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
3 changes: 2 additions & 1 deletion lib/carrierwave/video.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ def with_trancoding_callbacks(&block)
end
end

raise CarrierWave::ProcessingError.new("Failed to transcode with FFmpeg. Check ffmpeg install and verify video is not corrupt or cut short. Original error: #{e}")
raise e

ensure
reset_logger
send_callback(callbacks[:ensure])
Expand Down
2 changes: 1 addition & 1 deletion lib/carrierwave/video/ffmpeg_options.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def watermark_params
private

def defaults
@defaults ||= { resolution: '640x360', watermark: {} }.tap do |h|
@defaults ||= { resolution: @resolution, watermark: {} }.tap do |h|
case format
when 'mp4'
h[:video_codec] = 'libx264'
Expand Down
5 changes: 2 additions & 3 deletions spec/lib/carrierwave_video_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ def model
let(:e) { StandardError.new("test error") }
before { expect(File).to receive(:rename).and_raise(e) }


it "calls before_transcode and ensure" do
expect(converter.model).to receive(:method1).with(format, opts).ordered
expect(converter.model).not_to receive(:method2)
Expand All @@ -112,7 +111,7 @@ def model

expect do
converter.encode_video(format, opts)
end.to raise_exception(CarrierWave::ProcessingError)
end.to raise_exception(e.class)
end
end
end
Expand Down Expand Up @@ -145,7 +144,7 @@ def model

expect do
converter.encode_video(format, logger: :logger)
end.to raise_exception(CarrierWave::ProcessingError)
end.to raise_exception(e.class)
end
end
end
Expand Down

0 comments on commit d86dc91

Please sign in to comment.