Sha256: 53e2ac6657fd739dd5340add912c319aa57c356e07857702ec3277200b1d6d75

Contents?: true

Size: 1.56 KB

Versions: 78

Compression:

Stored size: 1.56 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(migrations)
      pending_migrations = migrations.join("\n")
      if rails? && defined?(Rails.env)
        super("Migrations are pending:\n#{pending_migrations}\n To resolve this issue, run:\n\n        #{command_name} neo4j:migrate RAILS_ENV=#{::Rails.env}")
      else
        super("Migrations are pending:\n#{pending_migrations}\n 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

78 entries across 78 versions & 2 rubygems

Version Path
neo4j-9.6.2 lib/neo4j/errors.rb
activegraph-10.0.0.pre.alpha.11 lib/neo4j/errors.rb
activegraph-10.0.0.pre.alpha.10 lib/neo4j/errors.rb
activegraph-10.0.0.pre.alpha.9 lib/neo4j/errors.rb
activegraph-10.0.0.pre.alpha.8 lib/neo4j/errors.rb
activegraph-10.0.0.pre.alpha.7 lib/neo4j/errors.rb
activegraph-10.0.0.pre.alpha.6 lib/neo4j/errors.rb
neo4j-10.0.0.pre.alpha.5 lib/neo4j/errors.rb
neo4j-10.0.0.pre.alpha.4 lib/neo4j/errors.rb
neo4j-10.0.0.pre.alpha.3 lib/neo4j/errors.rb
neo4j-10.0.0.pre.alpha.2 lib/neo4j/errors.rb
neo4j-10.0.0.pre.alpha.1 lib/neo4j/errors.rb
neo4j-9.6.1 lib/neo4j/errors.rb
neo4j-9.6.0 lib/neo4j/errors.rb
neo4j-9.5.3 lib/neo4j/errors.rb
neo4j-9.5.2 lib/neo4j/errors.rb
neo4j-9.5.0 lib/neo4j/errors.rb
neo4j-9.4.0 lib/neo4j/errors.rb
neo4j-9.3.0 lib/neo4j/errors.rb
neo4j-9.2.4 lib/neo4j/errors.rb