summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSzczepan Zalega <szczepan@nitrokey.com>2016-08-05 19:49:34 +0200
committerSzczepan Zalega <szczepan@nitrokey.com>2016-08-05 20:32:45 +0200
commit2675570622b808aec77be240b4663e29598049ef (patch)
tree1859af97ae7b0f5cf69142dd8775b17bef60c79e
parenta579c6906f9f7fe6e19c70a44f74c0d2148c8085 (diff)
downloadlibnitrokey-2675570622b808aec77be240b4663e29598049ef.tar.gz
libnitrokey-2675570622b808aec77be240b4663e29598049ef.tar.bz2
Catch runtime exceptions on C API login and show them on screen
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
-rw-r--r--NK_C_API.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/NK_C_API.cc b/NK_C_API.cc
index d2aa38a..d93283d 100644
--- a/NK_C_API.cc
+++ b/NK_C_API.cc
@@ -79,6 +79,10 @@ extern int NK_login(const char *device_model) {
NK_last_command_status = commandFailedException.last_command_status;
return commandFailedException.last_command_status;
}
+ catch (std::runtime_error &e){
+ cerr << e.what() << endl;
+ return 0;
+ }
return 0;
}