diff options
author | Robin Krahl <me@robin-krahl.de> | 2018-05-25 12:00:21 +0200 |
---|---|---|
committer | Robin Krahl <me@robin-krahl.de> | 2018-05-25 12:04:11 +0200 |
commit | f6e09cc2fb4541a15a57415439b575d7bf44b07f (patch) | |
tree | 1f5087f54e054797ac2ae3bdb9a072854347d188 /unittest/test_multiple.py | |
parent | aee920b21d3951d2166ff73a533461e1bdd16e7f (diff) | |
download | libnitrokey-f6e09cc2fb4541a15a57415439b575d7bf44b07f.tar.gz libnitrokey-f6e09cc2fb4541a15a57415439b575d7bf44b07f.tar.bz2 |
Refactor result retrieval in C API
The result retrieval functions get_with_array_result,
get_with_string_result, get_with_result and get_without_result currently
contain much duplicated code: the error handling. This patch tries to
simplify this code by introducing a new function, get_with_status, that
executes a function, catches errors and returns the error code together
with the result of the function or a fallback value passed by the user
if the function failed.
get_with_array_result, get_with_string_result and get_with_result are
adapted to use this function. get_without_result is not changed as it
has a different error handling logic than the other functions: It
ignores any InvalidCRCReceived exceptions.
Diffstat (limited to 'unittest/test_multiple.py')
0 files changed, 0 insertions, 0 deletions