Separate error for invalid version when updating mdata

Currently when you try to update mdata item using old version it will produce ClientError::InvalidEntryActions ERR_INVALID_ENTRY_ACTIONS) error. As far as I can understand this is a general error that is used for other potential problems too.

In concurrent environment it will happen rather often version to be invalid because in the gap between retrieving data and updating it some other client might updated it already.

Is it possible that separate error is defined for such cases like “ERR_INVALID_VERSION”? That way it will be much clearer what the problem is and retry the update (if needed by the business logic).

1 Like

You’re right. This type of error is sent when there are invalid entry actions sent in a MData.mutate() function. The reason why this type of error is send instead of a single error such as INVALID_VERSION is because different type of operations can be clubbed in a single mutation. When performing mutations, all these operations are attempted and the errors (if any) are added to a map which is returned with the error. Even if a single operation has errored, the mutation is not applied and the error list is returned.