Added ov::NotImplemented Exception (#11124)

* Added ov::NotImplemented Exception

* add ie namespace

* Try fix
This commit is contained in:
Anton Pankratov 2022-03-31 07:36:13 +03:00 committed by GitHub
parent 88e20199f0
commit 78285f9db4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 37 additions and 26 deletions

View File

@ -45,6 +45,13 @@ private:
const std::string& context_info,
const std::string& explanation);
};
/// Exception class to be thrown on not implemented code
class OPENVINO_API NotImplemented : public AssertFailure {
public:
NotImplemented(const CheckLocInfo& check_loc_info, const std::string& context_info, const std::string& explanation)
: AssertFailure(check_loc_info, context_info, explanation) {}
};
} // namespace ov
//
@ -139,6 +146,7 @@ private:
/// \throws ::ov::AssertFailure if the macro is executed.
#define OPENVINO_UNREACHABLE(...) OPENVINO_ASSERT(false, "Unreachable: ", __VA_ARGS__)
#define OPENVINO_ASSERT_HELPER(exc_class, ctx, ...) CALL_OVERLOAD(OPENVINO_ASSERT_HELPER, exc_class, ctx, __VA_ARGS__)
#define OPENVINO_NOT_IMPLEMENTED OPENVINO_ASSERT_HELPER(::ov::NotImplemented, "", false, "Not Implemented", "")
#define GLUE(x, y) x y

View File

@ -62,7 +62,7 @@ protected:
InferenceEngine::IInferRequestInternal::Ptr syncRequestImpl;
try {
syncRequestImpl = this->CreateInferRequestImpl(_parameters, _results);
} catch (const NotImplemented&) {
} catch (const InferenceEngine::NotImplemented&) {
}
if (!syncRequestImpl) {
syncRequestImpl = this->CreateInferRequestImpl(_networkInputs, _networkOutputs);

View File

@ -13,7 +13,8 @@
#include "description_buffer.hpp"
namespace InferenceEngine {
#define CATCH_IE_EXCEPTION_TO_STATUS(StatusCode, ExceptionType) catch (const ExceptionType& ex) { \
#define CATCH_IE_EXCEPTION_TO_STATUS(StatusCode, ExceptionType) \
catch (const InferenceEngine::ExceptionType& ex) { \
return InferenceEngine::DescriptionBuffer(StatusCode, resp) << ex.what(); \
}

View File

@ -16,7 +16,8 @@
namespace InferenceEngine {
#define CATCH_IE_EXCEPTION_TO_STATUS_NO_RESP(StatusCode, ExceptionType) catch (const ExceptionType& ex) { \
#define CATCH_IE_EXCEPTION_TO_STATUS_NO_RESP(StatusCode, ExceptionType) \
catch (const InferenceEngine::ExceptionType& ex) { \
return InferenceEngine::DescriptionBuffer(StatusCode) << ex.what(); \
}
@ -50,7 +51,8 @@ namespace InferenceEngine {
return InferenceEngine::DescriptionBuffer(UNEXPECTED); \
}
#define CATCH_IE_EXCEPTION_CALL_RETURN_STATUS(StatusCode, ExceptionType) catch (const ExceptionType& ex) { \
#define CATCH_IE_EXCEPTION_CALL_RETURN_STATUS(StatusCode, ExceptionType) \
catch (const InferenceEngine::ExceptionType& ex) { \
return InferenceEngine::DescriptionBuffer(StatusCode, resp) << ex.what(); \
}

View File

@ -134,7 +134,7 @@ void InferRequest::SetCompletionCallbackImpl(std::function<void()> callbackToSet
}
#define CATCH_IE_EXCEPTION_RETURN(StatusCode, ExceptionType) \
catch (const ExceptionType&) { \
catch (const ::InferenceEngine::ExceptionType&) { \
return StatusCode; \
}

View File

@ -61,7 +61,7 @@ std::shared_ptr<IInferRequestInternal> IExecutableNetworkInternal::CreateInferRe
std::shared_ptr<IInferRequestInternal> asyncRequestImpl;
try {
asyncRequestImpl = CreateInferRequestImpl(_parameters, _results);
} catch (const NotImplemented&) {
} catch (const InferenceEngine::NotImplemented&) {
}
if (!asyncRequestImpl)
asyncRequestImpl = CreateInferRequestImpl(_networkInputs, _networkOutputs);

View File

@ -312,7 +312,7 @@ void IInferRequestInternal::convertBatchedInputBlob(const std::string& name, con
if (net) {
remote_context = net->GetContext();
}
} catch (const NotImplemented&) {
} catch (const InferenceEngine::NotImplemented&) {
}
if (remote_context) {
mem_blob = remote_context->CreateHostBlob(batched_desc);

View File

@ -45,31 +45,31 @@ namespace details {
void Rethrow() {
try {
throw;
} catch (const GeneralError& e) {
} catch (const InferenceEngine::GeneralError& e) {
throw e;
} catch (const NotImplemented& e) {
} catch (const InferenceEngine::NotImplemented& e) {
throw e;
} catch (const NetworkNotLoaded& e) {
} catch (const InferenceEngine::NetworkNotLoaded& e) {
throw e;
} catch (const ParameterMismatch& e) {
} catch (const InferenceEngine::ParameterMismatch& e) {
throw e;
} catch (const NotFound& e) {
} catch (const InferenceEngine::NotFound& e) {
throw e;
} catch (const OutOfBounds& e) {
} catch (const InferenceEngine::OutOfBounds& e) {
throw e;
} catch (const Unexpected& e) {
} catch (const InferenceEngine::Unexpected& e) {
throw e;
} catch (const RequestBusy& e) {
} catch (const InferenceEngine::RequestBusy& e) {
throw e;
} catch (const ResultNotReady& e) {
} catch (const InferenceEngine::ResultNotReady& e) {
throw e;
} catch (const NotAllocated& e) {
} catch (const InferenceEngine::NotAllocated& e) {
throw e;
} catch (const InferNotStarted& e) {
} catch (const InferenceEngine::InferNotStarted& e) {
throw e;
} catch (const NetworkNotRead& e) {
} catch (const InferenceEngine::NetworkNotRead& e) {
throw e;
} catch (const InferCancelled& e) {
} catch (const InferenceEngine::InferCancelled& e) {
throw e;
} catch (const std::exception& e) {
IE_THROW() << e.what();

View File

@ -644,7 +644,7 @@ std::shared_ptr<InferenceEngine::RemoteContext> MultiDeviceExecutableNetwork::Ge
const auto& n = _networksPerDevice.at(device.deviceName);
try {
return n->GetContext();
} catch (const NotImplemented&) {}
} catch (const InferenceEngine::NotImplemented&) {}
}
IE_THROW(NotImplemented) << "None of the devices in the MULTI device has an associated remote context."
<< " Current list of devices allowed via the DEVICE_PRIORITIES config: " << devices_names;

View File

@ -1217,7 +1217,7 @@ Node* Node::NodesFactory::create(const std::shared_ptr<ngraph::Node>& op, const
if (ol != nullptr && ol->created(extMgr))
newNode = ol.release();
} catch (const InferenceEngine::Exception& ex) {
if (dynamic_cast<const NotImplemented*>(&ex) != nullptr) {
if (dynamic_cast<const InferenceEngine::NotImplemented*>(&ex) != nullptr) {
errorMessage += getExceptionDescWithoutStatus(ex);
} else {
throw;
@ -1231,7 +1231,7 @@ Node* Node::NodesFactory::create(const std::shared_ptr<ngraph::Node>& op, const
if (ol != nullptr && ol->created(extMgr))
newNode = ol.release();
} catch (const InferenceEngine::Exception& ex) {
if (dynamic_cast<const NotImplemented*>(&ex) != nullptr) {
if (dynamic_cast<const InferenceEngine::NotImplemented*>(&ex) != nullptr) {
const auto currErrorMess = getExceptionDescWithoutStatus(ex);
if (!currErrorMess.empty())
errorMessage += errorMessage.empty() ? currErrorMess : "\n" + currErrorMess;