From ba4d36c38c0017415129a5674c0f7133e6d76f9d Mon Sep 17 00:00:00 2001 From: Szczepan Zalega Date: Tue, 9 Aug 2016 15:33:26 +0200 Subject: Return error on invalid slot Signed-off-by: Szczepan Zalega --- NK_C_API.cc | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'NK_C_API.cc') diff --git a/NK_C_API.cc b/NK_C_API.cc index 4ba29ab..ea63f36 100644 --- a/NK_C_API.cc +++ b/NK_C_API.cc @@ -23,8 +23,8 @@ uint8_t * get_with_array_result(T func){ catch (CommandFailedException & commandFailedException){ NK_last_command_status = commandFailedException.last_command_status; } - catch (TooLongStringException & longStringException){ - NK_last_command_status = TooLongStringException::exception_id; + catch (LibraryException & libraryException){ + NK_last_command_status = libraryException.exception_id(); } return nullptr; } @@ -38,8 +38,8 @@ const char* get_with_string_result(T func){ catch (CommandFailedException & commandFailedException){ NK_last_command_status = commandFailedException.last_command_status; } - catch (TooLongStringException & longStringException){ - NK_last_command_status = TooLongStringException::exception_id; + catch (LibraryException & libraryException){ + NK_last_command_status = libraryException.exception_id(); } return ""; } @@ -53,8 +53,8 @@ auto get_with_result(T func){ catch (CommandFailedException & commandFailedException){ NK_last_command_status = commandFailedException.last_command_status; } - catch (TooLongStringException & longStringException){ - NK_last_command_status = TooLongStringException::exception_id; + catch (LibraryException & libraryException){ + NK_last_command_status = libraryException.exception_id(); } return static_cast(0); } @@ -68,12 +68,11 @@ uint8_t get_without_result(T func){ } catch (CommandFailedException & commandFailedException){ NK_last_command_status = commandFailedException.last_command_status; - return commandFailedException.last_command_status; } - catch (TooLongStringException & longStringException){ - NK_last_command_status = TooLongStringException::exception_id; - return NK_last_command_status; + catch (LibraryException & libraryException){ + NK_last_command_status = libraryException.exception_id(); } + return NK_last_command_status; } extern "C" -- cgit v1.2.1