Skip to content

Commit

Permalink
object/searchv2: Keep full error message in the status response
Browse files Browse the repository at this point in the history
Previously, `SearchV2` RPC server responded with the deepest Go error
message in the status message. To achieve this, the server made `errors
.Unwrap` to the lowest level. This approach was reused from other API
calls, so it brought up the same shortcomings to new search.

For example, CLI user could face following error:
```
rpc error: status: code = 1024 message = illegal base64 data at input byte 4
```
and only imagine which part of the request processing is an invalid
Base64.

This cancels error unwrapping for `SearchV2`, making it to respond with:
```
rpc error: status: code = 1024 message = invalid cursor: decode cursor from Base64: illegal base64 data at input byte 0
```
instead.

Note that previously existed RPCs are untouched to avoid system
destabilization. They will be considered separately.

Refs #2744. Refs #3058.

Signed-off-by: Leonard Lyubich <leonard@morphbits.io>
  • Loading branch information
cthulhu-rider committed Feb 21, 2025
1 parent 5d8fa17 commit b4e222c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/services/object/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -1883,7 +1883,7 @@ func (s *server) signSearchResponse(resp *protoobject.SearchV2Response) *protoob

func (s *server) makeStatusSearchResponse(err error) *protoobject.SearchV2Response {
return s.signSearchResponse(&protoobject.SearchV2Response{
MetaHeader: s.makeResponseMetaHeader(util.ToStatus(err)),
MetaHeader: s.makeResponseMetaHeader(apistatus.FromError(err)),
})
}

Expand Down

0 comments on commit b4e222c

Please sign in to comment.