Search code examples
cassandraphantom-dsl

How to does phantom handle errors


When inserting/updating into Cassandra, or when say the table defintion in the application does not match the table definition in the C* server, how does phantom handle these types of errors?

I see a result set that has wasApplied etc. but nothing about exceptions or errors.


Solution

  • If the error is catastrophic and the operation couldn't execute you will get back a failed future. One such example is a scala.concurrent.Future wrapping an InvalidQueryException for instance.

    Now there is a great degree of variety to what failure could mean. If you insert partial data that's valid in Cassandra, columns automatically set to null even if business wise this doesn't make sense in your application.

    The table definition should always match the table definition in the database if you use schema auto-generation via Database.create method, so phantom already provides a mechanism for you to do that automatically.