Module: Dapp::Helper::NetStatus

Defined in:
lib/dapp/helper/net_status.rb

Class Method Summary collapse

Class Method Details

.before_error_message(exception) ⇒ Object



18
19
20
# File 'lib/dapp/helper/net_status.rb', line 18

def before_error_message(exception)
  (net_status(exception)[:data][:before_error_messages] || []).join("\n")
end

.message(exception) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/dapp/helper/net_status.rb', line 9

def message(exception)
  net_status = net_status(exception)
  net_status[:message] || begin
    data = net_status[:data].reject {|k, _| k == :backtrace}
    data = nil if data.empty?
    [net_status[:error], [net_status[:context], net_status[:code]].compact.join('.'), data].compact.join(': ')
  end
end

.net_status(exception) ⇒ Object



5
6
7
# File 'lib/dapp/helper/net_status.rb', line 5

def net_status(exception)
  exception.net_status.net_status_normalize(context: exception.net_status.delete(:context))
end