From b98af44fcf89b9946e1de438b1f5527e6bf28905 Mon Sep 17 00:00:00 2001 From: Ivan Shapovalov Date: Sat, 22 Oct 2016 05:14:19 +0300 Subject: treewide: use C++ exceptions properly Since the codebase is designed around proper C++ idioms such as RAII, it makes sense to only use C++ exceptions internally instead of mixing exceptions and error codes. The exceptions are now caught at top level to preserve compatibility with the existing error code-based API. Note that we deliberately do not catch C++ runtime errors (such as `std::bad_alloc`) nor logic errors (aka failed assertions) because no actual handling can ever happen for such errors. However, in the C interface we do catch _all_ exceptions (...) and convert them into a wild-card error code. --- src/database/database.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/database') diff --git a/src/database/database.cpp b/src/database/database.cpp index 2340a89c..9b8537c2 100644 --- a/src/database/database.cpp +++ b/src/database/database.cpp @@ -92,7 +92,7 @@ Database::Database(const Queue &queue, const std::vector &kernels, } } - if (!search_result) { throw std::runtime_error("Database error, could not find a suitable entry"); } + if (!search_result) { throw RuntimeErrorCode(StatusCode::kDatabaseError); } } } -- cgit v1.2.3