# File lib/new_relic/agent/error_collector.rb, line 216
      def create_noticed_error(exception, options)
        error_metric = options.delete(:metric) || EMPTY_STRING

        noticed_error = NewRelic::NoticedError.new(error_metric, exception)
        noticed_error.request_uri = options.delete(:uri) || EMPTY_STRING
        noticed_error.request_port = options.delete(:port)
        noticed_error.attributes  = options.delete(:attributes)

        noticed_error.file_name   = sense_method(exception, :file_name)
        noticed_error.line_number = sense_method(exception, :line_number)
        noticed_error.stack_trace = extract_stack_trace(exception)

        handle_deprecated_options(options)

        noticed_error.attributes_from_notice_error = options.delete(:custom_params) || {}

        # Any options that are passed to notice_error which aren't known keys
        # get treated as custom attributes, so merge them into that hash.
        noticed_error.attributes_from_notice_error.merge!(options)

        noticed_error
      end