mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2025-05-11 10:25:47 +02:00
fix: missing error reply to client after AddOrFind throw std::bad_alloc (#2411)
* Handle properly and reply on execution paths that throw std::bad_alloc within AddOrFind
This commit is contained in:
parent
13718699d8
commit
39e7e5ad87
5 changed files with 69 additions and 19 deletions
|
@ -1076,7 +1076,12 @@ OpResult<bool> OpSet(const OpArgs& op_args, string_view key, string_view path,
|
|||
}
|
||||
}
|
||||
|
||||
SetJson(op_args, key, std::move(parsed_json.value()));
|
||||
try {
|
||||
SetJson(op_args, key, std::move(parsed_json.value()));
|
||||
|
||||
} catch (const bad_alloc& e) {
|
||||
return OpStatus::OUT_OF_MEMORY;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1154,7 +1159,9 @@ void JsonFamily::Set(CmdArgList args, ConnectionContext* cntx) {
|
|||
};
|
||||
|
||||
Transaction* trans = cntx->transaction;
|
||||
|
||||
OpResult<bool> result = trans->ScheduleSingleHopT(std::move(cb));
|
||||
|
||||
auto* rb = static_cast<RedisReplyBuilder*>(cntx->reply_builder());
|
||||
if (result) {
|
||||
if (*result) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue