deserialize: Handle wide range of exceptions
We seem to only catch std::length_error exception and cereal exception,
but all the other exceptions like std::bad_alloc are ignored. This
commit would ensure that we catch wide range of exceptions and makes
sure we delete the corrpted file in all error scenarios.
Change-Id: Ia607ec18fdce3385fb4857d9a0608f5d8d1e8704
Signed-off-by: Manojkiran Eda <manojkiran.eda@gmail.com>
diff --git a/src/manager_serialize.cpp b/src/manager_serialize.cpp
index 57b8991..473aa14 100644
--- a/src/manager_serialize.cpp
+++ b/src/manager_serialize.cpp
@@ -94,13 +94,7 @@
}
return false;
}
- catch (cereal::Exception& e)
- {
- lg2::error("Failed to serialize: {ERROR}", "ERROR", e);
- fs::remove(path);
- return false;
- }
- catch (const std::length_error& e)
+ catch (const std::exception& e)
{
lg2::error("Failed to serialize: {ERROR}", "ERROR", e);
fs::remove(path);