Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions core/transactions/attempt_context_impl.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1296,8 +1296,7 @@ attempt_context_impl::insert(const core::document_id& id,
self, "found existing insert or replace of {} while inserting", id);
return self->op_completed_with_error(
std::move(cb),
transaction_operation_failed(FAIL_DOC_ALREADY_EXISTS,
"found existing insert or replace of same document"));
document_exists("found existing insert or replace of same document"));
}
if (self->check_expiry_pre_commit(STAGE_INSERT, id.key())) {
return self->op_completed_with_error(
Expand Down Expand Up @@ -3694,9 +3693,7 @@ attempt_context_impl::create_staged_insert_error_handler(const core::document_id
if (doc->links().op() && *doc->links().op() != "insert") {
return self->op_completed_with_error(
std::forward<Handler>(cb),
transaction_operation_failed(FAIL_DOC_ALREADY_EXISTS,
"doc exists, not a staged insert")
.cause(DOCUMENT_EXISTS_EXCEPTION));
document_exists("doc exists, not a staged insert"));
}
self->check_and_handle_blocking_transactions(
*doc,
Expand Down
10 changes: 10 additions & 0 deletions core/transactions/exceptions.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,16 @@ public:
: op_exception(std::move(ctx), DOCUMENT_EXISTS_EXCEPTION)
{
}

explicit document_exists(transaction_op_error_context ctx, const std::string& what)
: op_exception(std::move(ctx), what, DOCUMENT_EXISTS_EXCEPTION)
{
}

explicit document_exists(const std::string& what)
: op_exception({ errc::transaction_op::document_exists }, what, DOCUMENT_EXISTS_EXCEPTION)
{
}
};

class query_attempt_not_found : public op_exception
Expand Down
Loading