Class: Exceptional::DetailsExceptionData

Inherits:
ExceptionData
  • Object
show all
Defined in:
lib/workety/extensions/exceptional.rb

Instance Method Summary collapse

Constructor Details

#initialize(exception) ⇒ DetailsExceptionData

Returns a new instance of DetailsExceptionData.



18
19
20
21
22
23
# File 'lib/workety/extensions/exceptional.rb', line 18

def initialize exception
  @exception = exception
  @details   = @exception.details.dup
  @name      = @details.delete(:name)
  @request   = @details[:request].kind_of?(Hash) && @details.delete(:request)
end

Instance Method Details

#context_stuffObject



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/workety/extensions/exceptional.rb', line 27

def context_stuff
  data = context_stuff_orig
  
  if @details.any?
    if data['context']
      data['context'].merge! @details
    else
      data['context'] = @details
    end
  end
  
  if @request
    data['request'] = {
      'url'        => @request[:url],
      'controller' => @request[:controller],
      'action'     => @request[:action],
      'parameters' => @request[:params],
      'headers'    => @request[:headers],
      'session'    => @request[:session]
      }
  end
  
  data
end

#context_stuff_origObject



25
# File 'lib/workety/extensions/exceptional.rb', line 25

alias_method :context_stuff_orig, :context_stuff