Sha256: 72eb4931f867aa895ca325d6b3e030339f444e983c8fdbc57dadf4fe87d3fbb3

Contents?: true

Size: 770 Bytes

Versions: 9

Compression:

Stored size: 770 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)
      msg ||= self.class::MESSAGE
      super
    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

9 entries across 9 versions & 1 rubygems

Version Path
isolator-0.5.0 lib/isolator/errors.rb
isolator-0.4.0 lib/isolator/errors.rb
isolator-0.3.0 lib/isolator/errors.rb
isolator-0.2.2 lib/isolator/errors.rb
isolator-0.2.1 lib/isolator/errors.rb
isolator-0.2.0 lib/isolator/errors.rb
isolator-0.1.1 lib/isolator/errors.rb
isolator-0.1.0 lib/isolator/errors.rb
isolator-0.1.0.pre2 lib/isolator/errors.rb