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:



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

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

Instance Method Details

#backtraceObject



110
111
112
# File 'lib/berkshelf/errors.rb', line 110

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

#original_backtraceObject



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

alias_method :original_backtrace, :backtrace

#status_codeObject



105
106
107
# File 'lib/berkshelf/errors.rb', line 105

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

#to_sObject Also known as: message



114
115
116
117
118
119
120
# File 'lib/berkshelf/errors.rb', line 114

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