Sha256: 8bfd5988b802d262c6e28a6a3d8682b56a9c889f1bc9666110acc7252369fece
Contents?: true
Size: 739 Bytes
Versions: 77
Compression:
Stored size: 739 Bytes
Contents
# frozen_string_literal: true require_dependency "renalware/system" module Renalware module System class APILog < ApplicationRecord validates :identifier, presence: true validates :status, presence: true STATUS_WORKING = "working" STATUS_DONE = "done" STATUS_ERROR = "error" def self.with_log(identifier, **args) log = create!(identifier: identifier, status: STATUS_WORKING, **args) yield(log) if block_given? log.update!(status: STATUS_DONE) log rescue StandardError => e log.update( status: STATUS_ERROR, error: "#{$ERROR_INFO}\nBacktrace:\n\t#{e.backtrace.join("\n\t")}" ) raise e end end end end
Version data entries
77 entries across 77 versions & 1 rubygems