Sha256: b880cb3e363d25f2b0d751d6a61fa1cca2a7a34fa3f823622dd77c6be555fe40
Contents?: true
Size: 1.64 KB
Versions: 6
Compression:
Stored size: 1.64 KB
Contents
# frozen-string-literal: true module Sequel # Exception class raised when +raise_on_save_failure+ is set and a before hook returns false # or an around hook doesn't call super or yield. class HookFailed < Error # The Sequel::Model instance related to this error. attr_reader :model def initialize(message=nil, model=nil) @model = model super(message) end end # Alias for HookFailed, kept for backwards compatibility BeforeHookFailed = HookFailed Sequel::Deprecation.deprecate_constant(self, :BeforeHookFailed) ( # Exception class raised when +require_modification+ is set and an UPDATE or DELETE statement to modify the dataset doesn't # modify a single row. NoExistingObject = Class.new(Error) ).name ( # Raised when an undefined association is used when eager loading. UndefinedAssociation = Class.new(Error) ).name ( # Raised when a mass assignment method is called in strict mode with either a restricted column # or a column without a setter method. MassAssignmentRestriction = Class.new(Error) ).name # Exception class raised when +raise_on_save_failure+ is set and validation fails class ValidationFailed < Error # The Sequel::Model object related to this exception. attr_reader :model # The Sequel::Model::Errors object related to this exception. attr_reader :errors def initialize(errors=nil) if errors.is_a?(Sequel::Model) @model = errors errors = @model.errors end if errors.respond_to?(:full_messages) @errors = errors super(errors.full_messages.join(', ')) else super end end end end
Version data entries
6 entries across 6 versions & 2 rubygems