From c8ac8481134aaf8d04e4e8ece266d43472034157 Mon Sep 17 00:00:00 2001 From: Szczepan Zalega Date: Thu, 16 Feb 2017 21:46:49 +0100 Subject: Handle disconnection while requesting device's status Signed-off-by: Szczepan Zalega --- NitrokeyManager.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/NitrokeyManager.cc b/NitrokeyManager.cc index fa32557..57ef878 100644 --- a/NitrokeyManager.cc +++ b/NitrokeyManager.cc @@ -144,8 +144,14 @@ namespace nitrokey{ } stick10::GetStatus::ResponsePayload NitrokeyManager::get_status(){ - auto response = GetStatus::CommandTransaction::run(device); - return response.data(); + try{ + auto response = GetStatus::CommandTransaction::run(device); + return response.data(); + } + catch (DeviceSendingFailure &e){ + disconnect(); + throw; + } } string NitrokeyManager::get_status_as_string() { -- cgit v1.2.3