Class: Tzispa::Helpers::Services::ErrorView
- Inherits:
-
Object
- Object
- Tzispa::Helpers::Services::ErrorView
- Defined in:
- lib/tzispa/helpers/services/error_view.rb
Instance Attribute Summary collapse
-
#exception ⇒ Object
readonly
Returns the value of attribute exception.
Instance Method Summary collapse
- #error_backtrace_list ⇒ Object
- #error_backtrace_log ⇒ Object
- #error_header ⇒ Object
-
#initialize(exception) ⇒ ErrorView
constructor
A new instance of ErrorView.
Constructor Details
#initialize(exception) ⇒ ErrorView
Returns a new instance of ErrorView.
10 11 12 |
# File 'lib/tzispa/helpers/services/error_view.rb', line 10 def initialize(exception) @exception = exception end |
Instance Attribute Details
#exception ⇒ Object (readonly)
Returns the value of attribute exception.
8 9 10 |
# File 'lib/tzispa/helpers/services/error_view.rb', line 8 def exception @exception end |
Instance Method Details
#error_backtrace_list ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/tzispa/helpers/services/error_view.rb', line 18 def error_backtrace_list return unless exception.respond_to?(:backtrace) && exception.backtrace String.new.tap do |str| str << '<ol>' str << exception.backtrace.map { |trace| "<li>#{trace}</li>\n" }.join str << '</ol>' end end |
#error_backtrace_log ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/tzispa/helpers/services/error_view.rb', line 27 def error_backtrace_log return unless exception.respond_to?(:backtrace) && exception.backtrace String.new.tap do |str| str << "#{exception.class.name}: #{exception}:\n" str << exception.backtrace.join("\n") end end |
#error_header ⇒ Object
14 15 16 |
# File 'lib/tzispa/helpers/services/error_view.rb', line 14 def error_header "<h1>#{exception.class.name}</h1><h3>#{exception.}</h3>" end |