class Honeybadger::Agent
def notify(exception_or_opts, opts = {})
-
(false)- when ignored. -
(String)- UUID reference to the notice within Honeybadger.
Options Hash:
(**opts)-
:cause(Exception) -- The cause for this error (optional). -
:url(String) -- The HTTP request URL (optional). -
:session(Hash) -- The HTTP request session (optional). -
:parameters(Hash) -- The HTTP request paramaters (optional). -
:action(String) -- The action name (such as a Rails controller action) (optional). -
:controller(String) -- The controller name (such as a Rails controller) (optional). -
:context(Hash) -- The context to associate with the exception (optional). -
:tags(String) -- The comma-separated list of tags (optional). -
:sync(Boolean) -- Send data synchronously (skips the worker) (optional). -
:force(Boolean) -- Always report the exception when true, even when ignored (optional). -
:fingerprint(String) -- The grouping fingerprint of the exception (optional). -
:backtrace(Array) -- The backtrace of the error (optional). -
:error_class(String) -- The class name of the error. -
:error_message(String) -- The error message.
Parameters:
-
opts(Hash) -- The options Hash when the first argument is an Exception. -
exception_or_opts(Exception, Hash, Object) -- An Exception object,
def notify(exception_or_opts, opts = {}) opts = opts.dup if exception_or_opts.is_a?(Exception) already_reported_notice_id = exception_or_opts.instance_variable_get(:@__hb_notice_id) return already_reported_notice_id if already_reported_notice_id 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) add_breadcrumb( "Honeybadger Notice", metadata: opts, category: "notice" ) if config[:'breadcrumbs.enabled'] opts[:rack_env] ||= context_manager.get_rack_env opts[:global_context] ||= context_manager.get_context opts[:breadcrumbs] ||= breadcrumbs.dup 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] || config[:sync] send_now(notice) else push(notice) end if exception_or_opts.is_a?(Exception) exception_or_opts.instance_variable_set(:@__hb_notice_id, notice.id) unless exception_or_opts.frozen? end notice.id end