class MovieMasher::Error::JobRender

a problem rendering output

Public Class Methods

new(ffmpeg_result, the_msg = 'failed to render') click to toggle source
Calls superclass method MovieMasher::Error::Runtime.new
# File lib/constant/error.rb, line 23
def initialize(ffmpeg_result, the_msg = 'failed to render')
  super(the_msg)
  error_lines = []
  error_lines << the_msg if the_msg
  if ffmpeg_result
    # puts ffmpeg_result
    lines = ffmpeg_result.split("\n")
    failure_words = %w(Error Invalid Failed)
    lines.reverse.each do |line|
      failure_words.each do |failure_word|
        if line.include? failure_word
          error_lines << line.split(/^\[.*\] /).last.strip
          break
        end
      end
    end
    error_lines << ffmpeg_result if error_lines.empty?
  end
  @msg = error_lines.join("\n") unless error_lines.empty?
end