exceptions.hpp
1 //*****************************************************************************
2 // Copyright 2017-2020 Intel Corporation
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //*****************************************************************************
16 
17 #pragma once
18 
19 #include <string>
20 
21 #include "ngraph/check.hpp"
22 #include "ngraph/except.hpp"
23 #include "onnx_import/core/node.hpp"
24 
25 namespace ngraph
26 {
27  namespace onnx_import
28  {
29  namespace error
30  {
31  namespace detail
32  {
33  std::string get_error_msg_prefix(const Node& node);
34  }
35 
37  {
38  public:
39  OnnxNodeValidationFailure(const CheckLocInfo& check_loc_info,
40  const Node& node,
41  const std::string& explanation)
42  : CheckFailure(check_loc_info, detail::get_error_msg_prefix(node), explanation)
43  {
44  }
45  };
46 
47  } // namespace error
48 
49  } // namespace onnx_import
50 
51 } // namespace ngraph
52 
53 #define CHECK_VALID_NODE(node_, cond_, ...) \
54  NGRAPH_CHECK_HELPER( \
55  ::ngraph::onnx_import::error::OnnxNodeValidationFailure, (node_), (cond_), ##__VA_ARGS__)
ngraph::CheckLocInfo
Definition: check.hpp:35
ngraph::CheckFailure
Base class for check failure exceptions.
Definition: check.hpp:43
ngraph::onnx_import::Node
Definition: node.hpp:56
ngraph
The Intel nGraph C++ API.
Definition: attribute_adapter.hpp:28
ngraph::onnx_import::error::OnnxNodeValidationFailure
Definition: exceptions.hpp:37