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.



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

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)


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

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

#proto_messageObject



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

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
  load_custom

  @proto_message
end

#to_pbObject



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

def to_pb
  @pb ||= proto_message.serialize_to_string
end