Sha256: fcb27d3ff0e61619e9c211165afd7be4fea2769c3adb99d6c5b64b4621b4efc3
Contents?: true
Size: 1.22 KB
Versions: 9
Compression:
Stored size: 1.22 KB
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 ActiveRemote::Validations when save is called on an invalid record. class RemoteRecordInvalid < ActiveRemoteError attr_reader :record def initialize(record) @record = record errors = @record.errors.full_messages.join(', ') super(errors) end 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
9 entries across 9 versions & 1 rubygems