Exception: ApplicationError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/tracer_client/errors/application_error.rb

Direct Known Subclasses

ApiError, LogicError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(subject, tags = '', data = {}) ⇒ ApplicationError

Returns a new instance of ApplicationError.



6
7
8
9
10
11
12
13
14
# File 'lib/tracer_client/errors/application_error.rb', line 6

def initialize(subject, tags = '', data = {})
  super(subject)
  @tags = tags
  @data = data

  puts "#{'-'*10}\n#{@data}\n#{'-'*10}" if Rails.env.development?

  Log.on_raise(self, caller(2))
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



3
4
5
# File 'lib/tracer_client/errors/application_error.rb', line 3

def data
  @data
end

#tagsObject (readonly)

Returns the value of attribute tags.



3
4
5
# File 'lib/tracer_client/errors/application_error.rb', line 3

def tags
  @tags
end

Instance Method Details

#with_alert?Boolean

для логирования при бросании и в дефолтном обработчике

Returns:

  • (Boolean)


24
25
26
# File 'lib/tracer_client/errors/application_error.rb', line 24

def with_alert?
  self.class.name.end_with?('Alert')
end

#with_log?Boolean

для логирования при бросании и в дефолтном обработчике

Returns:

  • (Boolean)


18
19
20
# File 'lib/tracer_client/errors/application_error.rb', line 18

def with_log?
  self.class.name.end_with?('Log', 'Alert')
end