Exception: Clearbooks::ClearbooksfileReadError

Inherits:
ClearbooksError show all
Defined in:
lib/clearbooks/error/errors.rb

Instance Method Summary collapse

Methods inherited from ClearbooksError

status_code

Constructor Details

#initialize(original_error) ⇒ ClearbooksfileReadError

Returns a new instance of ClearbooksfileReadError.

Parameters:



93
94
95
96
97
# File 'lib/clearbooks/error/errors.rb', line 93

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

Instance Method Details

#backtraceObject



104
105
106
# File 'lib/clearbooks/error/errors.rb', line 104

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

#original_backtraceObject



103
# File 'lib/clearbooks/error/errors.rb', line 103

alias_method :original_backtrace, :backtrace

#status_codeObject



99
100
101
# File 'lib/clearbooks/error/errors.rb', line 99

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

#to_sObject



108
109
110
111
112
113
114
# File 'lib/clearbooks/error/errors.rb', line 108

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