lib/wat_catcher/report.rb in wat_catcher-0.3.0 vs lib/wat_catcher/report.rb in wat_catcher-0.3.1
- old
+ new
@@ -12,11 +12,11 @@
def send_report
::WatCatcher::SidekiqPoster.perform_async("#{WatCatcher.configuration.host}/wats", params)
end
def params
- { wat: exception_description.merge(request_description).merge(worker_description).merge(param_exception_description) }
+ { wat: base_description.merge(exception_description).merge(request_description).merge(worker_description).merge(param_exception_description) }
end
def param_exception_description
return {} if exception || request.blank?
wat_params = request.params[:wat]
@@ -25,18 +25,23 @@
page_url: wat_params[:page_url],
request_params: nil
}
end
+ def base_description
+ {
+ app_env: ::Rails.env.to_s,
+ app_name: ::Rails.application.class.parent_name
+ }
+ end
+
def exception_description
return {} unless exception
{
backtrace: exception.backtrace.to_a,
message: exception.message,
error_class: exception.class.to_s,
- app_env: ::Rails.env.to_s,
- app_name: ::Rails.application.class.parent_name
}
end
def request_description
return {} unless request
@@ -51,10 +56,10 @@
session: session,
}
end
def headers
- Hash[*request.headers.select { |x| x.first !~ /\./ }.sort_by(&:first).flatten]
+ Hash[*request.headers.select { |x, y| y.instance_of? String }.sort_by(&:first).flatten]
end
def worker_description
return {} unless sidekiq
{