Module: Bugloco

Defined in:
lib/bugloco.rb,
lib/bugloco/rack.rb,
lib/bugloco/notice.rb,
lib/bugloco/railtie.rb,
lib/bugloco/version.rb,
lib/bugloco/configuration.rb,
lib/bugloco/rails/middleware.rb,
lib/bugloco/protobuf/bugloco.pb.rb

Defined Under Namespace

Modules: Proto, Rails Classes: Configuration, Notice, Rack, Railtie

Constant Summary collapse

HTTP_ERRORS =
[
Timeout::Error,
Errno::EINVAL,
Errno::ECONNRESET,
EOFError,
Net::HTTPBadResponse,
Net::HTTPHeaderSyntaxError,
Net::ProtocolError,
Errno::ECONNREFUSED,
OpenSSL::SSL::SSLError].freeze
VERSION =
"0.0.2"

Class Method Summary collapse

Class Method Details

.config {|@configuration| ... } ⇒ Object

Yields:

  • (@configuration)


38
39
40
41
42
# File 'lib/bugloco.rb', line 38

def config
  @configuration ||= Bugloco::Configuration.new
  yield(@configuration) if block_given?
  @configuration
end

.report_notice(exception, options = {}) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/bugloco.rb', line 23

def report_notice(exception, options = {})
  # TODO: We need to inform the user if api_key/project_id were not given
  encoded_notice = Bugloco::Notice.new(exception, options).to_pb
  encoded_response = send_notice(encoded_notice, options)

  if encoded_response
    response = Bugloco::Proto::Response.new.
      parse_from_string(encoded_response)

    response.notice_id if response.status == Bugloco::Proto::Status::SUCCESS
  else
    nil
  end
end