Class: Erorr::Notification

Inherits:
Object
  • Object
show all
Defined in:
lib/erorr/notification.rb

Instance Method Summary collapse

Constructor Details

#initialize(exception, params = {}) ⇒ Notification

Returns a new instance of Notification.



3
4
5
6
# File 'lib/erorr/notification.rb', line 3

def initialize(exception, params = {})
  @exception = exception
  @params = params
end

Instance Method Details

#to_paramsObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/erorr/notification.rb', line 8

def to_params
  {
    class: @exception.class.name,
    message: @exception.message,
    location: location,
    backtrace: backtrace.join("\n"),
    environment: Erorr.config.env,
    timestamp: Time.current,
    fingerprint: fingerprint,
    host: Socket.gethostname,
    pid: Process.pid,
    request_params: @params.dig(:request, :params),
    request_remote_ip: @params.dig(:request, :remote_ip),
    request_headers: @params.dig(:request, :headers),
  }
end