Class: EacRubyBase0::ErrorPresenter
- Inherits:
-
Object
- Object
- EacRubyBase0::ErrorPresenter
- Defined in:
- lib/eac_ruby_base0/error_presenter.rb
Instance Method Summary collapse
- #cause ⇒ EacRubyBase0::ErrorPresenter?
- #full_backtrace_message ⇒ String
- #full_message ⇒ String
- #log_path ⇒ Pathname
- #message ⇒ String
- #self_full_message ⇒ String
- #show ⇒ void
- #show_log_file ⇒ void
- #show_message(caused_by = false) ⇒ void
Instance Method Details
#cause ⇒ EacRubyBase0::ErrorPresenter?
10 11 12 |
# File 'lib/eac_ruby_base0/error_presenter.rb', line 10 memoize def cause the_error.cause.if_present { |v| self.class.new(v) } end |
#full_backtrace_message ⇒ String
15 16 17 |
# File 'lib/eac_ruby_base0/error_presenter.rb', line 15 def the_error.backtrace.map { |v| "#{v}\n" }.join end |
#full_message ⇒ String
20 21 22 23 24 |
# File 'lib/eac_ruby_base0/error_presenter.rb', line 20 def + cause.if_present('') do |e| "#{'-' * 16}\n#{e.}" end end |
#log_path ⇒ Pathname
32 33 34 |
# File 'lib/eac_ruby_base0/error_presenter.rb', line 32 def log_path @log_path ||= ::EacRubyUtils::Fs::Temp.file.to_pathname.tap { |e| e.write() } end |
#message ⇒ String
27 28 29 |
# File 'lib/eac_ruby_base0/error_presenter.rb', line 27 def "#{the_error.} (#{the_error.class})" end |
#self_full_message ⇒ String
37 38 39 40 41 |
# File 'lib/eac_ruby_base0/error_presenter.rb', line 37 def "Error class: #{the_error.class}\n" \ "Message: #{the_error.}\n" \ "Backtrace:\n" + the_error.backtrace.map { |v| "#{v}\n" }.join end |
#show ⇒ void
This method returns an undefined value.
44 45 46 47 |
# File 'lib/eac_ruby_base0/error_presenter.rb', line 44 def show show_log_file end |
#show_log_file ⇒ void
This method returns an undefined value.
57 58 59 |
# File 'lib/eac_ruby_base0/error_presenter.rb', line 57 def show_log_file infov 'Full log', log_path end |
#show_message(caused_by = false) ⇒ void
This method returns an undefined value.
50 51 52 53 54 |
# File 'lib/eac_ruby_base0/error_presenter.rb', line 50 def (caused_by = false) # rubocop:disable Style/OptionalBooleanParameter prefix = caused_by ? 'Caused by: ' : '' error [prefix, ].join cause.if_present { |v| v.(true) } end |