aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSzczepan Zalega <szczepan@nitrokey.com>2017-03-09 17:35:39 +0100
committerSzczepan Zalega <szczepan@nitrokey.com>2017-03-11 15:41:53 +0100
commit6c2e2c8177ff6bf5731ea25f3211fc6d889628d6 (patch)
tree6dd64608283f42e9efd3db1c2f3cdac4744b5d8c /include
parenta9c42dea301329136f663ebc9482a1d38feada29 (diff)
downloadlibnitrokey-6c2e2c8177ff6bf5731ea25f3211fc6d889628d6.tar.gz
libnitrokey-6c2e2c8177ff6bf5731ea25f3211fc6d889628d6.tar.bz2
Use own exception types instead of general runtime_error
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
Diffstat (limited to 'include')
-rw-r--r--include/device_proto.h6
1 files 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<std::string>(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++;