Sha256: 16925dde872742ce1affa59dcc0b3f2af085dfd9216e37f5b152a5453f61eeea

Contents?: true

Size: 779 Bytes

Versions: 7

Compression:

Stored size: 779 Bytes

Contents

module Rake
  module Funnel
    class ExecutionError < StandardError
      attr_reader :command, :exit_code, :output, :description

      def initialize(command = nil, exit_code = nil, output = nil, description = nil)
        super(description)

        @description = description
        @command = command
        @exit_code = exit_code
        @output = output
      end

      def to_s
        msg = []
        (msg << description << nil) if description
        (msg << 'Error executing:' << command << nil) if command
        (msg << "Exit code: #{exit_code}" << nil) if exit_code
        (msg << 'Command output (last 10 lines):' << output.split("\n").last(10) << nil) if output

        msg = [super.to_s] if msg.empty?

        msg.join("\n")
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
rake-funnel-0.9.0.pre lib/rake/funnel/execution_error.rb
rake-funnel-0.8.0.pre lib/rake/funnel/execution_error.rb
rake-funnel-0.7.0.pre lib/rake/funnel/execution_error.rb
rake-funnel-0.6.1.pre lib/rake/funnel/execution_error.rb
rake-funnel-0.6.0.pre lib/rake/funnel/execution_error.rb
rake-funnel-0.5.0.pre lib/rake/funnel/execution_error.rb
rake-funnel-0.4.0.pre lib/rake/funnel/execution_error.rb