lib/raygun/client.rb in raygun4ruby-0.0.3 vs lib/raygun/client.rb in raygun4ruby-0.0.4

- old
+ new

@@ -28,11 +28,11 @@ def error_details(exception) { className: exception.class.to_s, message: exception.message, - stackTrace: exception.backtrace.map { |line| stack_trace_for(line) } + stackTrace: (exception.backtrace || []).map { |line| stack_trace_for(line) } } end def stack_trace_for(line) # see http://www.ruby-doc.org/core-2.0/Exception.html#method-i-backtrace @@ -67,11 +67,11 @@ } end def headers(rack_env) rack_env.select do |k, v| - k.starts_with?("HTTP_") + k.to_s.starts_with?("HTTP_") end end def form_data(rack_env) request = Rack::Request.new(rack_env) @@ -80,18 +80,20 @@ request.body end end # see http://raygun.io/raygun-providers/rest-json-api?v=1 - def build_payload_hash(exception_instance, env) + def build_payload_hash(exception_instance, env = {}) + custom_data = env.delete(:custom_data) || {} + { occurredOn: Time.now.utc.iso8601, details: { machineName: hostname, version: version, client: client_details, error: error_details(exception_instance), - userCustomData: Raygun.configuration.custom_data, + userCustomData: Raygun.configuration.custom_data.merge(custom_data), request: request_information(env) } } end \ No newline at end of file