exceptions.hpp
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2023-2025, NVIDIA CORPORATION.
3  * SPDX-License-Identifier: Apache-2.0
4  */
5 #pragma once
6 #include <exception>
7 #include <string>
8 
9 namespace ML {
10 namespace fil {
11 
13 struct unusable_model_exception : std::exception {
14  unusable_model_exception() : msg_{"Model is not compatible with FIL"} {}
15  unusable_model_exception(std::string msg) : msg_{msg} {}
16  unusable_model_exception(char const* msg) : msg_{msg} {}
17  virtual char const* what() const noexcept { return msg_.c_str(); }
18 
19  private:
20  std::string msg_;
21 };
22 
24 struct model_import_error : std::exception {
25  model_import_error() : model_import_error("Error while importing model") {}
26  model_import_error(char const* msg) : msg_{msg} {}
27  virtual char const* what() const noexcept { return msg_; }
28 
29  private:
30  char const* msg_;
31 };
32 
40 struct type_error : std::exception {
41  type_error() : type_error("Model cannot be used with given data type") {}
42  type_error(char const* msg) : msg_{msg} {}
43  virtual char const* what() const noexcept { return msg_; }
44 
45  private:
46  char const* msg_;
47 };
48 
49 } // namespace fil
50 } // namespace ML
Definition: dbscan.hpp:18
Definition: exceptions.hpp:24
model_import_error()
Definition: exceptions.hpp:25
virtual char const * what() const noexcept
Definition: exceptions.hpp:27
model_import_error(char const *msg)
Definition: exceptions.hpp:26
Definition: exceptions.hpp:40
type_error(char const *msg)
Definition: exceptions.hpp:42
virtual char const * what() const noexcept
Definition: exceptions.hpp:43
type_error()
Definition: exceptions.hpp:41
Definition: exceptions.hpp:13
unusable_model_exception()
Definition: exceptions.hpp:14
unusable_model_exception(std::string msg)
Definition: exceptions.hpp:15
unusable_model_exception(char const *msg)
Definition: exceptions.hpp:16
virtual char const * what() const noexcept
Definition: exceptions.hpp:17