summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSzczepan Zalega <szczepan@nitrokey.com>2016-10-14 13:54:03 +0200
committerSzczepan Zalega <szczepan@nitrokey.com>2016-10-19 16:34:34 +0200
commitc2d8ba24fd7ea65d77d6a3f2a70764095575bcd0 (patch)
treee24ec1fc3768eaf7740f59dcbefa02b319659b50
parente0cef796093ff273c3bb5a51b2871c58328e033a (diff)
downloadlibnitrokey-c2d8ba24fd7ea65d77d6a3f2a70764095575bcd0.tar.gz
libnitrokey-c2d8ba24fd7ea65d77d6a3f2a70764095575bcd0.tar.bz2
Log when device reports command status not equal 0
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
-rw-r--r--include/CommandFailedException.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/include/CommandFailedException.h b/include/CommandFailedException.h
index 3306f7b..9b0c59e 100644
--- a/include/CommandFailedException.h
+++ b/include/CommandFailedException.h
@@ -7,6 +7,7 @@
#include <exception>
#include <cstdint>
+#include <log.h>
class CommandFailedException : public std::exception {
public:
@@ -15,7 +16,9 @@ public:
CommandFailedException(uint8_t last_command_code, uint8_t last_command_status) :
last_command_code(last_command_code),
- last_command_status(last_command_status){}
+ last_command_status(last_command_status){
+ nitrokey::log::Log::instance()(std::string("CommandFailedException, status: ")+ std::to_string(last_command_status), nitrokey::log::Loglevel::DEBUG);
+ }
virtual const char *what() const throw() {
return "Command execution has failed on device";