exceptions.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2023, NVIDIA 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 #pragma once
17 #include <exception>
18 #include <string>
19 
20 namespace ML {
21 namespace experimental {
22 namespace fil {
23 
25 struct unusable_model_exception : std::exception {
26  unusable_model_exception() : msg_{"Model is not compatible with experimental FIL"} {}
27  unusable_model_exception(std::string msg) : msg_{msg} {}
28  unusable_model_exception(char const* msg) : msg_{msg} {}
29  virtual char const* what() const noexcept { return msg_.c_str(); }
30 
31  private:
32  std::string msg_;
33 };
34 
36 struct model_import_error : std::exception {
37  model_import_error() : model_import_error("Error while importing model") {}
38  model_import_error(char const* msg) : msg_{msg} {}
39  virtual char const* what() const noexcept { return msg_; }
40 
41  private:
42  char const* msg_;
43 };
44 
52 struct type_error : std::exception {
53  type_error() : type_error("Model cannot be used with given data type") {}
54  type_error(char const* msg) : msg_{msg} {}
55  virtual char const* what() const noexcept { return msg_; }
56 
57  private:
58  char const* msg_;
59 };
60 
61 } // namespace fil
62 } // namespace experimental
63 } // namespace ML
Definition: dbscan.hpp:30
Definition: exceptions.hpp:36
virtual char const * what() const noexcept
Definition: exceptions.hpp:39
model_import_error(char const *msg)
Definition: exceptions.hpp:38
model_import_error()
Definition: exceptions.hpp:37
Definition: exceptions.hpp:52
type_error(char const *msg)
Definition: exceptions.hpp:54
virtual char const * what() const noexcept
Definition: exceptions.hpp:55
type_error()
Definition: exceptions.hpp:53
unusable_model_exception()
Definition: exceptions.hpp:26
unusable_model_exception(std::string msg)
Definition: exceptions.hpp:27
virtual char const * what() const noexcept
Definition: exceptions.hpp:29
unusable_model_exception(char const *msg)
Definition: exceptions.hpp:28