class Omnibus::Builder::ErrorReporter

@todo code duplication with {Fetcher::ErrorReporter}

Public Class Methods

new(error, fetcher) click to toggle source

@todo fetcher isn’t even used

# File lib/omnibus/builder.rb, line 73
def initialize(error, fetcher)
  @error, @fetcher = error, fetcher
end

Public Instance Methods

e() click to toggle source

@todo this isn’t necessary

# File lib/omnibus/builder.rb, line 78
def e
  @error
end
explain(why) click to toggle source
# File lib/omnibus/builder.rb, line 82
def explain(why)
  $stderr.puts "* " * 40
  $stderr.puts why
  $stderr.puts "Exception:"
  $stderr.puts indent("#{e.class}: #{e.message.strip}", 2)
  Array(e.backtrace).each {|l| $stderr.puts indent(l, 4) }
  $stderr.puts "* " * 40
end

Private Instance Methods

indent(string, n) click to toggle source
# File lib/omnibus/builder.rb, line 93
def indent(string, n)
  string.split("\n").map {|l| " ".rjust(n) << l }.join("\n")
end