Add `aggregate.IsConsistencyError`
Closed this issue · 1 comments
bounoable commented
MongoDB event store implements its own VersionError
and a IsConsistencyError()
function. Aggregates that implement repository.Retryer
must use the MongoDB-specific function if the MongoDB event store is used. There should be a single aggregate.IsConsistencyError
function to check for consistency errors. Implementation-specific errors can then provide a function to tell the aggregate.IsConsistencyError()
function if the error is a consistency error.
package mongo
type VersionError struct { ... }
func (err VersionError) IsConsistencyError() bool {
return true
}
package example
func example() {
var err mongo.VersionError
aggregate.IsConsistencyError(err) == true
var err aggregate.ConsistencyError
aggregate.IsConsistencyError(err) == true
}
bounoable commented
repository.Retryer.RetryUse()
can then return a single value because we can just use the aggregate.IsConsistencyError()
function to check if the operation should be retried.