Sha256: 819f9dd8cc611a1c84b5622cbb62eff0b964e343c7f612cc63cfcfa36f63017a

Contents?: true

Size: 955 Bytes

Versions: 11

Compression:

Stored size: 955 Bytes

Contents

# TODO: Create more specific errors
#
module ActiveRemote
  # Generic Active Remote exception class.
  class ActiveRemoteError < StandardError
  end

  # Raised by ActiveRemove::Base.save when the remote record is readonly.
  class ReadOnlyRemoteRecord < ActiveRemoteError
  end

  # Raised by ActiveRemove::Base.find when remote record is not found when
  # searching with the given arguments.
  class RemoteRecordNotFound < ActiveRemoteError
    attr_accessor :remote_record_class

    def initialize(class_or_message = "")
      message = class_or_message

      if class_or_message.is_a?(Class)
        self.remote_record_class = class_or_message
        message = "#{remote_record_class} does not exist"
      end

      super(message)
    end
  end

  # Raised by ActiveRemove::Base.save! and ActiveRemote::Base.create! methods
  # when remote record cannot be saved because it is invalid.
  class RemoteRecordNotSaved < ActiveRemoteError
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
active_remote-2.1.1 lib/active_remote/errors.rb
active_remote-2.1.0 lib/active_remote/errors.rb
active_remote-2.1.0.rc2 lib/active_remote/errors.rb
active_remote-2.1.0.rc1 lib/active_remote/errors.rb
active_remote-2.1.0.beta2 lib/active_remote/errors.rb
active_remote-2.1.0.beta1 lib/active_remote/errors.rb
active_remote-2.0.2 lib/active_remote/errors.rb
active_remote-2.0.1 lib/active_remote/errors.rb
active_remote-2.0.0 lib/active_remote/errors.rb
active_remote-2.0.0.rc2 lib/active_remote/errors.rb
active_remote-2.0.0.rc1 lib/active_remote/errors.rb