Class: ExceptionHunter::ErrorCreator
- Inherits:
-
Object
- Object
- ExceptionHunter::ErrorCreator
- Defined in:
- lib/exception_hunter/error_creator.rb
Overview
Core class in charge of the actual persistence of errors and notifications.
Constant Summary collapse
- HTTP_TAG =
'HTTP'.freeze
- WORKER_TAG =
'Worker'.freeze
- MANUAL_TAG =
'Manual'.freeze
- NOTIFICATION_DELAY =
1.minute
Class Method Summary collapse
-
.call(async_logging: Config.async_logging, tag: nil, **error_attrs) ⇒ ExceptionHunter::Error, false
Creates an error with the given attributes and persists it to the database.
Class Method Details
.call(async_logging: Config.async_logging, tag: nil, **error_attrs) ⇒ ExceptionHunter::Error, false
Creates an error with the given attributes and persists it to the database.
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/exception_hunter/error_creator.rb', line 15 def call(async_logging: Config.async_logging, tag: nil, **error_attrs) return unless should_create? if async_logging # Time is sent in unix format and then converted to Time to avoid ActiveJob::SerializationError ::ExceptionHunter::AsyncLoggingJob.perform_later(tag, error_attrs.merge(occurred_at: Time.now.to_i)) else create_error(tag, error_attrs) end rescue ActiveRecord::RecordInvalid false end |