Skip to content
This repository has been archived by the owner on Jul 22, 2020. It is now read-only.

Avoid exception if keyspace does not exist #66

Merged
merged 1 commit into from
Oct 14, 2017

Conversation

FuriKuri
Copy link
Contributor

@FuriKuri FuriKuri commented Oct 2, 2017

Summary

I've replace keyspaces.first with keyspaces.filter. At the moment keyspaces.first will throw a NoSuchElementException. With keyspaces.filter the full statement will return false and a CassandraMigrationException will be thrown.

Stack trace before:

Exception in thread "main" java.util.NoSuchElementException: Collection contains no element matching the predicate.
  at com.builtamont.cassandra.migration.CassandraMigration.execute$cassandra_migration(CassandraMigration.kt:535)
  at com.builtamont.cassandra.migration.CassandraMigration.execute$cassandra_migration$default(CassandraMigration.kt:263)
  at com.builtamont.cassandra.migration.CassandraMigration.migrate(CassandraMigration.kt:168)
  at com.builtamont.cassandra.migration.CommandLine.main(CommandLine.kt:68)

Stack trace after:

Exception in thread "main" com.builtamont.cassandra.migration.api.CassandraMigrationException: Keyspace: cassandra_migration_test does not exist.
  at com.builtamont.cassandra.migration.CassandraMigration.execute$cassandra_migration(CassandraMigration.kt:347)
  at com.builtamont.cassandra.migration.CassandraMigration.execute$cassandra_migration$default(CassandraMigration.kt:263)
  at com.builtamont.cassandra.migration.CassandraMigration.migrate(CassandraMigration.kt:168)
  at com.builtamont.cassandra.migration.CommandLine.main(CommandLine.kt:68)

Pull Request (PR) Checklist

Documentation

  • Documentation in README.md or Wiki updated
  • Update Release Notes if applicable -- collaborator-access only

Code Review

  • Self code review -- take another pass through the changes yourself
  • Completed all relevant TODOs, or call them out in the PR comments

Tests

  • All tests passes

@hhandoko
Copy link
Owner

hhandoko commented Oct 9, 2017

Thanks for your contribution! There's some issue with the CI, I'll merge this as soon as I can fix it (the CI issue).

@hhandoko hhandoko merged commit 03a205b into hhandoko:master Oct 14, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants