1 // Copyright (C) 2018-2019 Intel Corporation
2 // SPDX-License-Identifier: Apache-2.0
6 * \brief Wrappers from c++ function to c-style one
12 #include "description_buffer.hpp"
14 namespace InferenceEngine {
17 * @brief conversion of c++ exceptioned function call into c-style one
21 } catch (const InferenceEngine::details::InferenceEngineException & iex) { \
22 return InferenceEngine::DescriptionBuffer((iex.hasStatus() ? iex.getStatus() : GENERAL_ERROR), \
23 resp) << iex.what(); \
24 } catch (const std::exception & ex) {\
25 return InferenceEngine::DescriptionBuffer(GENERAL_ERROR, resp) << ex.what();\
27 return InferenceEngine::DescriptionBuffer(UNEXPECTED);\
30 * convert exception to status variable
32 #define TO_STATUSVAR(x, statusVar, descBufferVar)\
34 try {x; statusVar = OK;\
35 } catch (const InferenceEngine::details::InferenceEngineException & iex) { \
36 statusVar = InferenceEngine::DescriptionBuffer((iex.hasStatus() ? iex.getStatus() : GENERAL_ERROR), \
37 descBufferVar) << iex.what(); \
38 } catch (const std::exception & ex) {\
39 statusVar = InferenceEngine::DescriptionBuffer(GENERAL_ERROR, descBufferVar) << ex.what();\
41 statusVar = InferenceEngine::DescriptionBuffer(UNEXPECTED);\
45 #define TO_STATUS_NO_RESP(x)\
47 } catch (const InferenceEngine::details::InferenceEngineException & iex) { \
48 return InferenceEngine::DescriptionBuffer(iex.hasStatus() ? iex.getStatus() : GENERAL_ERROR)\
50 } catch (const std::exception & ex) {\
51 return InferenceEngine::DescriptionBuffer(GENERAL_ERROR) << ex.what();\
53 return InferenceEngine::DescriptionBuffer(UNEXPECTED);\
56 #define NO_EXCEPT_CALL_RETURN_VOID(x)\
58 } catch (const std::exception & ex) {\
62 #define NO_EXCEPT_CALL_RETURN_STATUS(x)\
64 } catch (const InferenceEngine::details::InferenceEngineException & iex) { \
65 return InferenceEngine::DescriptionBuffer(iex.hasStatus() ? iex.getStatus() : GENERAL_ERROR, \
66 resp) << iex.what(); \
67 } catch (const std::exception & ex) {\
68 return InferenceEngine::DescriptionBuffer(GENERAL_ERROR, resp) << ex.what();\
70 return InferenceEngine::DescriptionBuffer(UNEXPECTED);\
73 // TODO: replace by hierarchy of exceptions
74 #define PARAMETER_MISMATCH_str std::string("[PARAMETER_MISMATCH] ")
75 #define NETWORK_NOT_LOADED_str std::string("[NETWORK_NOT_LOADED] ")
76 #define NOT_FOUND_str std::string("[NOT_FOUND] ")
77 #define RESULT_NOT_READY_str std::string("[RESULT_NOT_READY] ")
78 #define INFER_NOT_STARTED_str std::string("[INFER_NOT_STARTED] ")
79 #define REQUEST_BUSY_str std::string("[REQUEST_BUSY] ")
80 #define NOT_IMPLEMENTED_str std::string("[NOT_IMPLEMENTED] ")
81 #define NOT_ALLOCATED_str std::string("[NOT_ALLOCATED] ")
83 } // namespace InferenceEngine