• R/O
  • HTTP
  • SSH
  • HTTPS

提交

標籤
無標籤

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Never give up


Commit MetaInfo

修訂dc02d89282b1beb6ffcea3d8091acf28f42d9d2c (tree)
時間2018-01-25 14:13:37
作者HMML <hmml3939@gmai...>
CommiterHMML

Log Message

Fix error class on creating voice preview.

Change Summary

差異

--- a/lib/paperclip_processors/voice_preview.rb
+++ b/lib/paperclip_processors/voice_preview.rb
@@ -38,18 +38,18 @@ class VoicePreview < Paperclip::Processor
3838 end
3939 if tfiles.size < 3
4040 Rails.logger.error "Preview target is missing. zip entry count=#{Zip::ZipFile.foreach(src.path).count}"
41- raise I18n.t("voice_preview.err_missing")
41+ raise Paperclip::Error, I18n.t("voice_preview.err_missing")
4242 end
4343 tfiles.each do |tf|
4444 `soxi -t "#{tf}"`.chomp.downcase == 'vorbis' &&
4545 `soxi -e "#{tf}"`.chomp.downcase == 'vorbis' or
46- raise I18n.t("voice_preview.err_not_ogg")
46+ raise Paperclip::Error, I18n.t("voice_preview.err_not_ogg")
4747 `soxi -r "#{tf}"`.to_i == 44100 && `soxi -c "#{tf}"`.to_i == 1 and next
4848 rtmp = "#{tmpdir}/rate-convert-tmp-#{$$}.ogg"
49- system('sox', tf, '-c', '1', '-r', '44100', rtmp) or raise I18n.t("voice_preview.err_normalize")
49+ system('sox', tf, '-c', '1', '-r', '44100', rtmp) or raise Paperclip::Error, I18n.t("voice_preview.err_normalize")
5050 FileUtils.mv rtmp, tf
5151 end
52- system(*['sox', tfiles.sort, dst_path].flatten) or raise I18n.t("voice_preview.err_concat")
52+ system(*['sox', tfiles.sort, dst_path].flatten) or raise Paperclip::Error, I18n.t("voice_preview.err_concat")
5353 rescue => e
5454 Rails.logger.error "Failed to generate preview voice: #{e.backtrace.first}: #{e.message}, last error is #{$?}"
5555 FileUtils.mkdir_p "#{Rails.root}/tmp/failed"