Moved ngraph::ngraph_error to ov::Exception (#7235)
This commit is contained in:
@@ -4,22 +4,19 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <ngraph/deprecated.hpp>
|
||||
#include <ngraph/ngraph_visibility.hpp>
|
||||
#include <sstream>
|
||||
#include <stdexcept>
|
||||
|
||||
#include "openvino/core/except.hpp"
|
||||
|
||||
namespace ngraph {
|
||||
/// Base error for ngraph runtime errors.
|
||||
class NGRAPH_API ngraph_error : public std::runtime_error {
|
||||
public:
|
||||
explicit ngraph_error(const std::string& what_arg) : std::runtime_error(what_arg) {}
|
||||
using ngraph_error = ov::Exception;
|
||||
|
||||
explicit ngraph_error(const char* what_arg) : std::runtime_error(what_arg) {}
|
||||
|
||||
explicit ngraph_error(const std::stringstream& what_arg) : std::runtime_error(what_arg.str()) {}
|
||||
};
|
||||
|
||||
class NGRAPH_API unsupported_op : public std::runtime_error {
|
||||
class NGRAPH_DEPRECATED("This class is deprecated and will be removed soon.") NGRAPH_API unsupported_op
|
||||
: public std::runtime_error {
|
||||
public:
|
||||
unsupported_op(const std::string& what_arg) : std::runtime_error(what_arg) {}
|
||||
};
|
||||
|
||||
23
ngraph/core/include/openvino/core/except.hpp
Normal file
23
ngraph/core/include/openvino/core/except.hpp
Normal file
@@ -0,0 +1,23 @@
|
||||
// Copyright (C) 2018-2021 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <sstream>
|
||||
#include <stdexcept>
|
||||
|
||||
#include "openvino/core/core_visibility.hpp"
|
||||
|
||||
namespace ov {
|
||||
/// Base error for ov runtime errors.
|
||||
class OPENVINO_API Exception : public std::runtime_error {
|
||||
public:
|
||||
explicit Exception(const std::string& what_arg) : std::runtime_error(what_arg) {}
|
||||
|
||||
explicit Exception(const char* what_arg) : std::runtime_error(what_arg) {}
|
||||
|
||||
explicit Exception(const std::stringstream& what_arg) : std::runtime_error(what_arg.str()) {}
|
||||
};
|
||||
|
||||
} // namespace ov
|
||||
@@ -38,6 +38,7 @@ constexpr NodeTypeInfo UnhandledOp::type_info;
|
||||
} // namespace
|
||||
|
||||
NGRAPH_TEST(${BACKEND_NAME}, unhandled_op) {
|
||||
NGRAPH_SUPPRESS_DEPRECATED_START
|
||||
Shape shape{2, 2};
|
||||
auto A = make_shared<op::Parameter>(element::f32, shape);
|
||||
auto unhandled = make_shared<UnhandledOp>(A);
|
||||
@@ -47,4 +48,5 @@ NGRAPH_TEST(${BACKEND_NAME}, unhandled_op) {
|
||||
shared_ptr<runtime::Tensor> a = backend->create_tensor<float>(shape);
|
||||
shared_ptr<runtime::Tensor> result = backend->create_tensor<float>(shape);
|
||||
ASSERT_THROW(auto handle = backend->compile(f); handle->call_with_validate({result}, {a}), unsupported_op);
|
||||
NGRAPH_SUPPRESS_DEPRECATED_END
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user