Class: Bugloco::Notice

Inherits:
Object
  • Object
show all
Defined in:
lib/bugloco/notice.rb

Constant Summary collapse

EXCEPTION_REGEX =
/^(?<path>[^:]*):(?<line_number>[0-9]*):in `(?<function_name>[^']*)'$/
IGNORE_DEFAULT =
['ActiveRecord::RecordNotFound',
'ActionController::RoutingError',
'ActionController::InvalidAuthenticityToken',
'CGI::Session::CookieStore::TamperedWithCookie',
'ActionController::UnknownHttpMethod',
'ActionController::UnknownAction',
'AbstractController::ActionNotFound',
'Mongoid::Errors::DocumentNotFound',
'ActionController::UnknownFormat']

Instance Method Summary collapse

Constructor Details

#initialize(exception, options = {}) ⇒ Notice

Returns a new instance of Notice.



20
21
22
23
24
25
# File 'lib/bugloco/notice.rb', line 20

def initialize(exception, options = {})
  @exception = exception
  @options = options
  @rack_env = @options[:rack_env] if @options[:rack_env]
  @proto_message = nil
end

Instance Method Details

#ignore?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/bugloco/notice.rb', line 31

def ignore?
  IGNORE_DEFAULT.include?(@exception.class.to_s)
end

#proto_messageObject



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/bugloco/notice.rb', line 35

def proto_message
  return @proto_message unless @proto_message.nil?

  @proto_message = Bugloco::Proto::Notice.new

  load_company
  load_project
  load_exception_class_and_message
  load_info_about_notifier
  load_request
  load_running_mode
  load_server_info
  load_backtrace
  load_stack

  @proto_message
end

#to_pbObject



27
28
29
# File 'lib/bugloco/notice.rb', line 27

def to_pb
  @pb ||= proto_message.serialize_to_string
end