Class: Renalware::UKRDC::TransmissionLog
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Renalware::UKRDC::TransmissionLog
- Defined in:
- app/models/renalware/ukrdc/transmission_log.rb
Class Method Summary collapse
Class Method Details
.formatted_exception(error) ⇒ Object
25 26 27 28 29 30 |
# File 'app/models/renalware/ukrdc/transmission_log.rb', line 25 def self.formatted_exception(error) [ "#{error.backtrace.first}: #{error.} (#{error.class})", error.backtrace.drop(1).map{ |line| "\t#{line}" } ].join("\n") end |
.with_logging(patient, request_uuid) ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'app/models/renalware/ukrdc/transmission_log.rb', line 14 def self.with_logging(patient, request_uuid) log = new(patient: patient, sent_at: Time.zone.now, request_uuid: request_uuid) yield log if block_given? log.save! rescue StandardError => error log.error = formatted_exception(error) log.status = :error log.save! raise error end |