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