Skip to content

Commit

Permalink
feat: Add SendError overload for capturing rb
Browse files Browse the repository at this point in the history
Signed-off-by: Vladislav Oleshko <[email protected]>
  • Loading branch information
dranikpg committed Aug 3, 2023
1 parent a21a5a9 commit fe43785
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/facade/reply_capture.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ void CapturingReplyBuilder::SendError(std::string_view str, std::string_view typ
Capture(Error{str, type});
}

void CapturingReplyBuilder::SendError(ErrorReply error) {
SKIP_LESS(ReplyMode::ONLY_ERR);

string message = visit([](auto&& str) -> string { return string{move(str)}; }, error.message);
Capture(Error{move(message), error.kind});
}

void CapturingReplyBuilder::SendMGetResponse(absl::Span<const OptResp> arr) {
SKIP_LESS(ReplyMode::FULL);
Capture(vector<OptResp>{arr.begin(), arr.end()});
Expand Down
1 change: 1 addition & 0 deletions src/facade/reply_capture.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class CapturingReplyBuilder : public RedisReplyBuilder {

public:
void SendError(std::string_view str, std::string_view type = {}) override;
void SendError(ErrorReply error) override;
void SendMGetResponse(absl::Span<const OptResp>) override;

// SendStored -> SendSimpleString("OK")
Expand Down

0 comments on commit fe43785

Please sign in to comment.