def notify(exception_or_opts, opts = {})
      if exception_or_opts.is_a?(Exception)
        opts[:exception] = exception_or_opts
      elsif exception_or_opts.respond_to?(:to_hash)
        opts.merge!(exception_or_opts.to_hash)
      else
        opts[:error_message] = exception_or_opts.to_s
      end

      validate_notify_opts!(opts)

      opts[:rack_env] ||= context_manager.get_rack_env
      opts[:global_context] ||= context_manager.get_context

      notice = Notice.new(config, opts)

      config.before_notify_hooks.each do |hook|
        break if notice.halted?
        with_error_handling { hook.call(notice) }
      end

      unless notice.api_key =~ NOT_BLANK
        error { sprintf('Unable to send error report: API key is missing. id=%s', notice.id) }
        return false
      end

      if !opts[:force] && notice.ignore?
        debug { sprintf('ignore notice feature=notices id=%s', notice.id) }
        return false
      end

      if notice.halted?
        debug { 'halted notice feature=notices' }
        return false
      end

      info { sprintf('Reporting error id=%s', notice.id) }

      if opts[:sync]
        send_now(notice)
      else
        push(notice)
      end

      notice.id
    end
def notify(exception_or_opts, opts = {})
      if exception_or_opts.is_a?(Exception)
        opts[:exception] = exception_or_opts
      elsif exception_or_opts.respond_to?(:to_hash)
        opts.merge!(exception_or_opts.to_hash)
      else
        opts[:error_message] = exception_or_opts.to_s
      end

      validate_notify_opts!(opts)

      opts[:rack_env] ||= context_manager.get_rack_env
      opts[:global_context] ||= context_manager.get_context

      notice = Notice.new(config, opts)

      config.before_notify_hooks.each do |hook|
        break if notice.halted?
        with_error_handling { hook.call(notice) }
      end

      unless notice.api_key =~ NOT_BLANK
        error { sprintf('Unable to send error report: API key is missing. id=%s', notice.id) }
        return false
      end

      if !opts[:force] && notice.ignore?
        debug { sprintf('ignore notice feature=notices id=%s', notice.id) }
        return false
      end

      if notice.halted?
        debug { 'halted notice feature=notices' }
        return false
      end

      info { sprintf('Reporting error id=%s', notice.id) }

      if opts[:sync]
        send_now(notice)
      else
        push(notice)
      end

      notice.id
    end
Sends an exception to Honeybadger. Does not report ignored exceptions by
 default.

 @example
   # With an exception:
   begin
     fail 'oops'
   rescue => exception
     Honeybadger.notify(exception, context: {
       my_data: 'value'
     }) # => '-1dfb92ae-9b01-42e9-9c13-31205b70744a'
   end

   # Custom notification:
   Honeybadger.notify('Something went wrong.', {
     error_class: 'MyClass',
     context: {my_data: 'value'}
   }) # => '06220c5a-b471-41e5-baeb-de247da45a56'

 @param [Exception, Hash, Object] exception_or_opts An Exception object,
   or a Hash of options which is used to build the notice. All other types
   of objects will be converted to a String and used as the :error_message.
 @param [Hash] opts The options Hash when the first argument is an Exception.

 @option opts [String]    :error_message The error message.
 @option opts [String]    :error_class ('Notice') The class name of the error.
 @option opts [Array]     :backtrace The backtrace of the error (optional).
 @option opts [String]    :fingerprint The grouping fingerprint of the exception (optional).
 @option opts [Boolean]   :force (false) Always report the exception when true, even when ignored (optional).
 @option opts [String]    :tags The comma-separated list of tags (optional).
 @option opts [Hash]      :context The context to associate with the exception (optional).
 @option opts [String]    :controller The controller name (such as a Rails controller) (optional).
 @option opts [String]    :action The action name (such as a Rails controller action) (optional).
 @option opts [Hash]      :parameters The HTTP request paramaters (optional).
 @option opts [Hash]      :session The HTTP request session (optional).
 @option opts [String]    :url The HTTP request URL (optional).
 @option opts [Exception] :cause The cause for this error (optional).

 @return [String] UUID reference to the notice within Honeybadger.
 @return [false] when ignored.