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
36 37 38 39 40 41 |
# File 'app/models/renalware/ukrdc/transmission_log.rb', line 36 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, **options) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'app/models/renalware/ukrdc/transmission_log.rb', line 21 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 => e log.error << formatted_exception(e) log.status = :error log.save! raise e end |