Sha256: db072e7f510b6617c74b90b45f98f94cc34d8d184a4850671dc200df1fe67f93

Contents?: true

Size: 1.48 KB

Versions: 111

Compression:

Stored size: 1.48 KB

Contents

# frozen-string-literal: true

module Sequel
  # Exception class raised when +raise_on_save_failure+ is set and an action is canceled in a hook.
  # or an around hook doesn't 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

  (
  # 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

111 entries across 94 versions & 2 rubygems

Version Path
sequel-5.72.0 lib/sequel/model/exceptions.rb
sequel-5.71.0 lib/sequel/model/exceptions.rb
sequel-5.70.0 lib/sequel/model/exceptions.rb
sequel-5.69.0 lib/sequel/model/exceptions.rb
sequel-5.68.0 lib/sequel/model/exceptions.rb
sequel-5.67.0 lib/sequel/model/exceptions.rb
sequel-5.66.0 lib/sequel/model/exceptions.rb
sequel-5.65.0 lib/sequel/model/exceptions.rb
sequel-5.64.0 lib/sequel/model/exceptions.rb
sequel-5.63.0 lib/sequel/model/exceptions.rb
tdiary-5.2.4 vendor/bundle/ruby/3.1.0/gems/sequel-5.62.0/lib/sequel/model/exceptions.rb
sequel-5.62.0 lib/sequel/model/exceptions.rb
sequel-5.61.0 lib/sequel/model/exceptions.rb
sequel-5.60.1 lib/sequel/model/exceptions.rb
tdiary-5.2.3 vendor/bundle/ruby/3.1.0/gems/sequel-5.59.0/lib/sequel/model/exceptions.rb
sequel-5.59.0 lib/sequel/model/exceptions.rb
sequel-5.58.0 lib/sequel/model/exceptions.rb
sequel-5.57.0 lib/sequel/model/exceptions.rb
tdiary-5.2.2 vendor/bundle/ruby/3.1.0/gems/sequel-5.56.0/lib/sequel/model/exceptions.rb
sequel-5.56.0 lib/sequel/model/exceptions.rb