aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSzczepan Zalega <szczepan@nitrokey.com>2017-02-16 21:46:49 +0100
committerSzczepan Zalega <szczepan@nitrokey.com>2017-03-11 15:41:46 +0100
commitc8ac8481134aaf8d04e4e8ece266d43472034157 (patch)
tree6a2e518ac9a8a0dbb3725485c92ab63f6cadf0d6
parent3d96df28fe95deb096a19e3886381ef360b978d8 (diff)
downloadlibnitrokey-c8ac8481134aaf8d04e4e8ece266d43472034157.tar.gz
libnitrokey-c8ac8481134aaf8d04e4e8ece266d43472034157.tar.bz2
Handle disconnection while requesting device's status
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
-rw-r--r--NitrokeyManager.cc10
1 files 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() {