From 6c2e2c8177ff6bf5731ea25f3211fc6d889628d6 Mon Sep 17 00:00:00 2001 From: Szczepan Zalega Date: Thu, 9 Mar 2017 17:35:39 +0100 Subject: Use own exception types instead of general runtime_error Signed-off-by: Szczepan Zalega --- include/device_proto.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/device_proto.h b/include/device_proto.h index 1eb637f..f1f52d6 100644 --- a/include/device_proto.h +++ b/include/device_proto.h @@ -239,7 +239,7 @@ namespace nitrokey { LOG("Outgoing HID packet:", Loglevel::DEBUG); LOG(static_cast(outp), Loglevel::DEBUG); - if (!outp.isValid()) throw std::runtime_error("Invalid outgoing packet"); + if (!outp.isValid()) throw DeviceSendingFailure("Invalid outgoing packet"); bool successful_communication = false; int receiving_retry_counter = 0; @@ -368,9 +368,9 @@ namespace nitrokey { resp.command_id, resp.device_status, resp.storage_status.progress_bar_value); } - if (!resp.isValid()) throw std::runtime_error("Invalid incoming packet"); + if (!resp.isValid()) throw DeviceReceivingFailure("Invalid incoming packet"); if (receiving_retry_counter <= 0) - throw std::runtime_error( //TODO change to other kind to handle correctly by caller, communication exception? + throw DeviceReceivingFailure( "Maximum receiving_retry_counter count reached for receiving response from the device!"); dev->m_counters.communication_successful++; -- cgit v1.2.3