module Captivus class Payload def initialize(exception) if exception.respond_to?(:class) && exception.class.respond_to?(:name) && exception.respond_to?(:message) @as_json = { 'event' => { 'type' => exception.class.name, 'message' => exception.message, 'timestamp' => Time.now.utc.to_s }, 'backtrace' => Backtrace.new(exception).as_json } else raise ArgumentError, "Unexpected exception: #{exception.inspect}" end end attr_reader :as_json end end