aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/CommandFailedException.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/include/CommandFailedException.h b/include/CommandFailedException.h
index 3753ad4..190eabc 100644
--- a/include/CommandFailedException.h
+++ b/include/CommandFailedException.h
@@ -8,6 +8,9 @@
#include <exception>
#include <cstdint>
#include "log.h"
+#include "command_id.h"
+
+using cs = nitrokey::proto::stick10::command_status;
class CommandFailedException : public std::exception {
public:
@@ -25,7 +28,11 @@ public:
}
bool reason_slot_not_programmed() const throw(){
- return last_command_status == 3; //FIXME use enum status codes
+ return last_command_status == static_cast<uint8_t>(cs::slot_not_programmed);
+ }
+
+ bool reason_wrong_password() const throw(){
+ return last_command_status == static_cast<uint8_t>(cs::wrong_password);
}
};