diff options
-rw-r--r-- | include/DeviceCommunicationExceptions.h | 5 | ||||
-rw-r--r-- | include/device_proto.h | 2 |
2 files changed, 6 insertions, 1 deletions
diff --git a/include/DeviceCommunicationExceptions.h b/include/DeviceCommunicationExceptions.h index 6d21561..2913975 100644 --- a/include/DeviceCommunicationExceptions.h +++ b/include/DeviceCommunicationExceptions.h @@ -36,5 +36,10 @@ public: DeviceReceivingFailure(std::string msg) : DeviceCommunicationException(msg){} }; +class InvalidCRCReceived: public DeviceReceivingFailure { +public: + InvalidCRCReceived(std::string msg) : DeviceReceivingFailure(msg){} +}; + #endif //LIBNITROKEY_DEVICECOMMUNICATIONEXCEPTIONS_H diff --git a/include/device_proto.h b/include/device_proto.h index b137689..964c2d9 100644 --- a/include/device_proto.h +++ b/include/device_proto.h @@ -371,7 +371,7 @@ namespace nitrokey { resp.command_id, resp.device_status, resp.storage_status.progress_bar_value); } - if (!resp.isValid()) throw DeviceReceivingFailure("Invalid incoming packet"); + if (!resp.isValid()) throw InvalidCRCReceived("Invalid incoming packet"); if (receiving_retry_counter <= 0) throw DeviceReceivingFailure( "Maximum receiving_retry_counter count reached for receiving response from the device!"); |