Sha256: 5ecefcb4b0ea4657afeb61298080d57a221f45998458fac7835ab45cdd2ae61d

Contents?: true

Size: 831 Bytes

Versions: 10

Compression:

Stored size: 831 Bytes

Contents

# frozen_string_literal: true

module Isolator # :nodoc: all
  class UnsafeOperationError < StandardError
    MESSAGE = "You are trying to do unsafe operation inside db transaction"

    def initialize(msg = nil, details: nil)
      msg ||= self.class::MESSAGE
      super(details ? "#{msg}\nDetails: #{details}" : msg)
    end
  end

  class HTTPError < UnsafeOperationError
    MESSAGE = "You are trying to make an outgoing network request inside db transaction. "
  end

  class BackgroundJobError < UnsafeOperationError
    MESSAGE = "You are trying to enqueue background job inside db transaction. " \
      "In case of transaction failure, this may lead to data inconsistency and unexpected bugs"
  end

  class MailerError < UnsafeOperationError
    MESSAGE = "You are trying to send email inside db transaction."
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
isolator-1.0.1 lib/isolator/errors.rb
isolator-1.0.0 lib/isolator/errors.rb
isolator-0.11.0 lib/isolator/errors.rb
isolator-0.10.0 lib/isolator/errors.rb
isolator-0.9.0 lib/isolator/errors.rb
isolator-0.8.0 lib/isolator/errors.rb
isolator-0.7.0 lib/isolator/errors.rb
isolator-0.6.2 lib/isolator/errors.rb
isolator-0.6.1 lib/isolator/errors.rb
isolator-0.6.0 lib/isolator/errors.rb