diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2022-07-29 09:20:47 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2022-07-29 09:58:34 +0300 |
commit | c6e1eb1483962ef5e4d00bd9b7a6e627c42fea0d (patch) | |
tree | 61d4d0378ef17043e7c1a8b5f8419a6df2953b19 /ruby/proto | |
parent | baa43620149725399c530c063a3377d5eb865d0d (diff) |
proto: Introduce FindTagError to distinguish non-existent tagspks-find-tag-error
When the FindTag RPC is invoked with a tag that doesn't exist then we
return an `Internal` gRPC error. This is clearly not ideal given that
those errors count against our SLOs, and furthermore it's an expected
error condition to say that a tag does not exist. We should thus slap on
a proper error code in that condition.
This raises an issue in the Rails codebase though because the `NotFound`
code is typically used to indicate a missing repository. So if we now
also start to retrun `NotFound` for missing tags then it's hard for
Rails to distinguish those two error conditions without matching the
error's message.
To fix this issue we introduce a structured error that gives the caller
a clear indication that the reference was indeed not found so that they
can distinguish those two conditions.
Diffstat (limited to 'ruby/proto')
-rw-r--r-- | ruby/proto/gitaly/errors_pb.rb | 4 | ||||
-rw-r--r-- | ruby/proto/gitaly/ref_pb.rb | 4 |
2 files changed, 8 insertions, 0 deletions
diff --git a/ruby/proto/gitaly/errors_pb.rb b/ruby/proto/gitaly/errors_pb.rb index 620b645e5..f772b7291 100644 --- a/ruby/proto/gitaly/errors_pb.rb +++ b/ruby/proto/gitaly/errors_pb.rb @@ -31,6 +31,9 @@ Google::Protobuf::DescriptorPool.generated_pool.build do optional :reference_name, :bytes, 1 optional :oid, :string, 2 end + add_message "gitaly.ReferenceNotFoundError" do + optional :reference_name, :bytes, 1 + end add_message "gitaly.ReferenceUpdateError" do optional :reference_name, :bytes, 1 optional :old_oid, :string, 2 @@ -65,6 +68,7 @@ module Gitaly MergeConflictError = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("gitaly.MergeConflictError").msgclass ReferencesLockedError = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("gitaly.ReferencesLockedError").msgclass ReferenceExistsError = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("gitaly.ReferenceExistsError").msgclass + ReferenceNotFoundError = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("gitaly.ReferenceNotFoundError").msgclass ReferenceUpdateError = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("gitaly.ReferenceUpdateError").msgclass ResolveRevisionError = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("gitaly.ResolveRevisionError").msgclass LimitError = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("gitaly.LimitError").msgclass diff --git a/ruby/proto/gitaly/ref_pb.rb b/ruby/proto/gitaly/ref_pb.rb index bfd341832..72aa78039 100644 --- a/ruby/proto/gitaly/ref_pb.rb +++ b/ruby/proto/gitaly/ref_pb.rb @@ -73,6 +73,9 @@ Google::Protobuf::DescriptorPool.generated_pool.build do add_message "gitaly.FindTagResponse" do optional :tag, :message, 1, "gitaly.Tag" end + add_message "gitaly.FindTagError" do + optional :tag_not_found, :message, 1, "gitaly.ReferenceNotFoundError" + end add_message "gitaly.FindAllTagsRequest" do optional :repository, :message, 1, "gitaly.Repository" optional :sort_by, :message, 2, "gitaly.FindAllTagsRequest.SortBy" @@ -239,6 +242,7 @@ module Gitaly FindAllBranchesResponse::Branch = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("gitaly.FindAllBranchesResponse.Branch").msgclass FindTagRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("gitaly.FindTagRequest").msgclass FindTagResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("gitaly.FindTagResponse").msgclass + FindTagError = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("gitaly.FindTagError").msgclass FindAllTagsRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("gitaly.FindAllTagsRequest").msgclass FindAllTagsRequest::SortBy = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("gitaly.FindAllTagsRequest.SortBy").msgclass FindAllTagsRequest::SortBy::Key = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("gitaly.FindAllTagsRequest.SortBy.Key").enummodule |