From 5f719d72027a7e9a9bcd2ae4582fa611bd76cb20 Mon Sep 17 00:00:00 2001 From: Yueh-Hsuan Chiang Date: Thu, 4 Dec 2014 11:11:11 -0800 Subject: [PATCH] Replace exception by setting valid_ = false in DBIter::MergeValuesNewToOld() Summary: Replace exception by setting valid_ = false in DBIter::MergeValuesNewToOld(). Test Plan: Not sure if I am right at this, but it seems we currently don't have a good way to test that code path as it requires dynamically set merge_operator = nullptr at the time while Merge() is calling. Reviewers: igor, sdong Reviewed By: sdong Subscribers: dhruba, leveldb Differential Revision: https://reviews.facebook.net/D29811 --- db/db_iter.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/db/db_iter.cc b/db/db_iter.cc index 78decd8b1..1b5bf860e 100644 --- a/db/db_iter.cc +++ b/db/db_iter.cc @@ -281,8 +281,9 @@ void DBIter::MergeValuesNewToOld() { if (!user_merge_operator_) { Log(InfoLogLevel::ERROR_LEVEL, logger_, "Options::merge_operator is null."); - throw std::logic_error("DBIter::MergeValuesNewToOld() with" - " Options::merge_operator null"); + status_ = Status::InvalidArgument("user_merge_operator_ must be set."); + valid_ = false; + return; } // Start the merge process by pushing the first operand