From 527f82e169873b6f24de732f1c7cf95ea31ce71c Mon Sep 17 00:00:00 2001 From: seolheui kim Date: Thu, 28 Jun 2018 17:53:18 +0900 Subject: [PATCH] Remove the check empty token and add catch the exception Change-Id: I2b1e66c4ad138d8d210c70e9e5801c34360e059d Signed-off-by: seolheui kim --- server/upgrade-support.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/server/upgrade-support.cpp b/server/upgrade-support.cpp index 91c1263..2195603 100644 --- a/server/upgrade-support.cpp +++ b/server/upgrade-support.cpp @@ -238,16 +238,14 @@ void removeMasterKey(const std::string &device) runtime::File file(getTokenFileName(device)); readToken(file, token); - // already removed - if (token.empty()) { - INFO(SINK, "Token for " + device + " does not exist. Ignoring."); - return; - } - auto& up = KeyStoragePlugin::Instance(); up.remove(token); - file.remove(); + try { + file.remove(); + } catch (runtime::Exception &e) { + ERROR(SINK, "Failed to remove token: " + std::string(e.what())); + } } } // namespace UpgradeSupport -- 2.34.1