Sha256: 483d1a96261b08527b011554c4a65d97c806789a700a6f72387322108143436b

Contents?: true

Size: 1.45 KB

Versions: 12

Compression:

Stored size: 1.45 KB

Contents

module Neo4j
  # Neo4j.rb Errors
  # Generic Neo4j.rb exception class.
  class Error < StandardError
  end

  # Raised when Neo4j.rb cannot find record by given id.
  class RecordNotFound < Error
    attr_reader :model, :primary_key, :id

    def initialize(message = nil, model = nil, primary_key = nil, id = nil)
      @primary_key = primary_key
      @model = model
      @id = id

      super(message)
    end
  end

  class DeprecatedSchemaDefinitionError < Error; end

  class InvalidPropertyOptionsError < Error; end

  class InvalidParameterError < Error; end

  class UnknownTypeConverterError < Error; end

  class DangerousAttributeError < ScriptError; end
  class UnknownAttributeError < NoMethodError; end

  class MigrationError < Error; end
  class IrreversibleMigration < MigrationError; end
  class UnknownMigrationVersionError < MigrationError; end

  # Inspired/taken from active_record/migration.rb
  class PendingMigrationError < MigrationError
    def initialize
      if rails? && defined?(Rails.env)
        super("Migrations are pending. To resolve this issue, run:\n\n        #{command_name} neo4j:migrate RAILS_ENV=#{::Rails.env}")
      else
        super("Migrations are pending. To resolve this issue, run:\n\n        #{command_name} neo4j:migrate")
      end
    end

    private

    def command_name
      return 'rake' unless rails?
      Rails.version.to_f >= 5 ? 'bin/rails' : 'bin/rake'
    end

    def rails?
      defined?(Rails)
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
neo4j-8.0.0.rc.3 lib/neo4j/errors.rb
neo4j-8.0.0.rc.2 lib/neo4j/errors.rb
neo4j-8.0.0.rc.1 lib/neo4j/errors.rb
neo4j-8.0.0.alpha.12 lib/neo4j/errors.rb
neo4j-8.0.0.alpha.11 lib/neo4j/errors.rb
neo4j-8.0.0.alpha.10 lib/neo4j/errors.rb
neo4j-8.0.0.alpha.9 lib/neo4j/errors.rb
neo4j-8.0.0.alpha.8 lib/neo4j/errors.rb
neo4j-8.0.0.alpha.7 lib/neo4j/errors.rb
neo4j-8.0.0.alpha.6 lib/neo4j/errors.rb
neo4j-8.0.0.alpha.5 lib/neo4j/errors.rb
neo4j-8.0.0.alpha.4 lib/neo4j/errors.rb