Skip to content

operations: Introduce structured errors for UserCreateTag

The UserCreateTag RPC has several conditions where it fails to create the tag, but still returns a successful response. That response may either contain a pre-receive error message indicating that updating the reference has failed because of one of multiple reasons, or it may indicate that the tag exists already.

Returning successfully in error cases is a code smell, and we have started to convert all RPCs that do this to instead return structured errors. With these structured errors, we are able to keep up the semantics that failure to perform the action results in an error but keep the client's ability to special-case some specific errors.

Convert UserCreateTag to do the same and return UserCreateTagErrors. This both gives us better visibility into what exactly is happening on the Gitaly side and fixes another case where we needlessly create replication jobs because of missing transactional votes.

Closes #4137 (closed).

Merge request reports