Sha256: a63b23b219b7c0bd652a4b33f34ac1e8661ee4f544c1d50c46664ba36c14e58d

Contents?: true

Size: 1.57 KB

Versions: 17

Compression:

Stored size: 1.57 KB

Contents

module ActiveGraph
  # 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

17 entries across 17 versions & 1 rubygems

Version Path
activegraph-10.2.0.beta.1 lib/active_graph/errors.rb
activegraph-10.1.1 lib/active_graph/errors.rb
activegraph-10.1.0 lib/active_graph/errors.rb
activegraph-10.0.2 lib/active_graph/errors.rb
activegraph-10.0.1 lib/active_graph/errors.rb
activegraph-10.0.0 lib/active_graph/errors.rb
activegraph-10.0.0.pre.beta.11 lib/active_graph/errors.rb
activegraph-10.0.0.pre.beta.10 lib/active_graph/errors.rb
activegraph-10.0.0.pre.beta.9 lib/active_graph/errors.rb
activegraph-10.0.0.pre.beta.8 lib/active_graph/errors.rb
activegraph-10.0.0.pre.beta.7 lib/active_graph/errors.rb
activegraph-10.0.0.pre.beta.6 lib/active_graph/errors.rb
activegraph-10.0.0.pre.beta.5 lib/active_graph/errors.rb
activegraph-10.0.0.pre.beta.4 lib/active_graph/errors.rb
activegraph-10.0.0.pre.beta.3 lib/active_graph/errors.rb
activegraph-10.0.0.pre.beta.2 lib/active_graph/errors.rb
activegraph-10.0.0.pre.beta.1 lib/active_graph/errors.rb