ReactiveCouchbase / ReactiveCouchbase-es

Event Store based on ReactiveCouchbase
http://reactivecouchbase.org/
Apache License 2.0
2 stars 3 forks source link

Atomic.atomicallyUpdate throws ClassCastException when the key cannot be found #3

Closed athasach closed 10 years ago

athasach commented 10 years ago

For cases where "myKey" cannot be found, the future returned from atomicallyUpdate returns a failed future with

ClassCastException: scala.concurrent.impl.Promise$KeptPromise cannot be cast to MyData

It would be useful if the failed future indicated the not found status instead. I'm thinking of cases where I'm providing a RESTful service and want to return a 404 Not Found status. Since a ClassCastException could be thrown for other reasons, it's difficult to discern when it's truly a casting issue or a not found issue.

bucket.atomicallyUpdate[MyData]("myKey") { currentValue =>
  foo(currentValue)
}

Thanks.

athasach commented 10 years ago

Oops. This issue should have been posted to ReactiveCouchbase-core instead.