aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSzczepan Zalega <szczepan@nitrokey.com>2017-05-25 13:12:15 +0200
committerSzczepan Zalega <szczepan@nitrokey.com>2017-05-25 13:12:28 +0200
commit2f4d104d33fabcfb63c635db2b6cc92be651f44a (patch)
tree739a0b6b850f29b0213f739bf87b8e27c6151166
parent5d640e412305428dc3d290511aacd40487ebeea7 (diff)
downloadlibnitrokey-2f4d104d33fabcfb63c635db2b6cc92be651f44a.tar.gz
libnitrokey-2f4d104d33fabcfb63c635db2b6cc92be651f44a.tar.bz2
Catch invalid CRC exception in C API
To handle invalid response packets in C API Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
-rw-r--r--NK_C_API.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/NK_C_API.cc b/NK_C_API.cc
index 0e3fa1f..209b378 100644
--- a/NK_C_API.cc
+++ b/NK_C_API.cc
@@ -76,6 +76,12 @@ uint8_t get_without_result(T func){
catch (LibraryException & libraryException){
NK_last_command_status = libraryException.exception_id();
}
+ catch (const InvalidCRCReceived &invalidCRCException){
+ ;;;
+ }
+ catch (const DeviceCommunicationException &deviceException){
+ NK_last_command_status = -1;
+ }
return NK_last_command_status;
}