diff options
| -rw-r--r-- | NK_C_API.cc | 14 | 
1 files changed, 14 insertions, 0 deletions
| diff --git a/NK_C_API.cc b/NK_C_API.cc index f86ce47..6afce74 100644 --- a/NK_C_API.cc +++ b/NK_C_API.cc @@ -64,6 +64,9 @@ uint8_t * get_with_array_result(T func){      catch (LibraryException & libraryException){          NK_last_command_status = libraryException.exception_id();      } +    catch (const DeviceCommunicationException &deviceException){ +      NK_last_command_status = 256-deviceException.getType(); +    }      return nullptr;  } @@ -79,6 +82,9 @@ const char* get_with_string_result(T func){      catch (LibraryException & libraryException){          NK_last_command_status = libraryException.exception_id();      } +    catch (const DeviceCommunicationException &deviceException){ +      NK_last_command_status = 256-deviceException.getType(); +    }      return "";  } @@ -94,6 +100,9 @@ auto get_with_result(T func){      catch (LibraryException & libraryException){          NK_last_command_status = libraryException.exception_id();      } +    catch (const DeviceCommunicationException &deviceException){ +      NK_last_command_status = 256-deviceException.getType(); +    }      return static_cast<decltype(func())>(0);  } @@ -140,6 +149,11 @@ extern "C" {  			NK_last_command_status = commandFailedException.last_command_status;  			return commandFailedException.last_command_status;  		} +    catch (const DeviceCommunicationException &deviceException){ +      NK_last_command_status = 256-deviceException.getType(); +      cerr << deviceException.what() << endl; +      return 0; +    }  		catch (std::runtime_error &e) {  			cerr << e.what() << endl;  			return 0; | 
