Exception: Berkshelf::BerksfileReadError

Inherits:
BerkshelfError show all
Defined in:
lib/berkshelf/errors.rb

Instance Method Summary collapse

Methods inherited from BerkshelfError

set_status_code

Constructor Details

#initialize(original_error) ⇒ BerksfileReadError

Returns a new instance of BerksfileReadError.

Parameters:


89
90
91
92
93
# File 'lib/berkshelf/errors.rb', line 89

def initialize(original_error)
  @original_error  = original_error
  @error_message   = original_error.to_s
  @error_backtrace = original_error.backtrace
end

Instance Method Details

#backtraceObject


100
101
102
# File 'lib/berkshelf/errors.rb', line 100

def backtrace
  Array(@error_backtrace) + Array(original_backtrace)
end

#original_backtraceObject


99
# File 'lib/berkshelf/errors.rb', line 99

alias_method :original_backtrace, :backtrace

#status_codeObject


95
96
97
# File 'lib/berkshelf/errors.rb', line 95

def status_code
  @original_error.respond_to?(:status_code) ? @original_error.status_code : 113
end

#to_sObject


104
105
106
107
108
109
110
# File 'lib/berkshelf/errors.rb', line 104

def to_s
  [
    "An error occurred while reading the Berksfile:",
    "",
    "  #{@error_message}",
  ].join("\n")
end