Sha256: bb40cefbdba35a84fd1187df3d04a4664b3fbabe65096038848d854e94e023ee

Contents?: true

Size: 477 Bytes

Versions: 3

Compression:

Stored size: 477 Bytes

Contents

# frozen_string_literal: true

module Biscuit
  class ExecutionError < StandardError
    def initialize(stderr, stdout=nil)
      @stdout = stdout
      @stderr = stderr
      super(message)
    end

    def message
      messages = []
      messages << "std_out: #{truncate(@stdout)}" if @stdout
      messages << "std_err: #{truncate(@stderr)}" if @stderr
      messages.join(" ")
    end

    private

    def truncate(message)
      message.slice(0, 200)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
biscuit-0.2.0 lib/biscuit/execution_error.rb
biscuit-0.1.4 lib/biscuit/execution_error.rb
biscuit-0.1.3 lib/biscuit/execution_error.rb