helics  2.8.1
core-exceptions.hpp
Go to the documentation of this file.
1 /*
2 Copyright (c) 2017-2021,
3 Battelle Memorial Institute; Lawrence Livermore National Security, LLC; Alliance for Sustainable
4 Energy, LLC. See the top-level NOTICE for additional details. All rights reserved.
5 SPDX-License-Identifier: BSD-3-Clause
6 */
7 #pragma once
8 #include <stdexcept>
9 #include <string>
10 #include <utility>
11 
16 namespace helics {
18 class HelicsException: public std::exception {
19  private:
20  std::string errorMessage = "HELICS EXCEPTION";
21 
22  public:
23  HelicsException() = default;
24  explicit HelicsException(const std::string& message) noexcept: errorMessage(message) {}
25  virtual const char* what() const noexcept override { return errorMessage.c_str(); }
26 };
27 
30  public:
31  explicit FunctionExecutionFailure(
32  const std::string& message = "HELICS execution failure") noexcept:
33  HelicsException(message)
34  {
35  }
36 };
37 
40  public:
41  explicit InvalidIdentifier(const std::string& message = "invalid identifier") noexcept:
42  HelicsException(message)
43  {
44  }
45 };
46 
49  public:
50  explicit InvalidParameter(const std::string& message = "invalid parameter") noexcept:
51  HelicsException(message)
52  {
53  }
54 };
55 
58  public:
59  explicit InvalidConversion(
60  const std::string& message = "unable to perform the requested conversion") noexcept:
61  HelicsException(message)
62  {
63  }
64 };
65 
68  public:
69  explicit InvalidFunctionCall(const std::string& message = "invalid function call") noexcept:
70  HelicsException(message)
71  {
72  }
73 };
74 
77  public:
78  explicit ConnectionFailure(const std::string& message = "failed to connect") noexcept:
79  HelicsException(message)
80  {
81  }
82 };
83 
86  public:
87  explicit RegistrationFailure(const std::string& message = "registration failure") noexcept:
88  HelicsException(message)
89  {
90  }
91 };
92 
95  public:
96  explicit HelicsSystemFailure(const std::string& message = "HELICS system failure") noexcept:
97  HelicsException(message)
98  {
99  }
100 };
101 } // namespace helics
helics::InvalidIdentifier
Definition: core-exceptions.hpp:39
helics::HelicsSystemFailure
Definition: core-exceptions.hpp:94
helics::ConnectionFailure
Definition: core-exceptions.hpp:76
helics::InvalidFunctionCall
Definition: core-exceptions.hpp:67
helics::InvalidParameter
Definition: core-exceptions.hpp:48
helics::InvalidConversion
Definition: core-exceptions.hpp:57
helics::RegistrationFailure
Definition: core-exceptions.hpp:85
helics
the main namespace for the helics co-simulation library User functions will be in the helics namespac...
Definition: AsyncFedCallInfo.hpp:14
helics::FunctionExecutionFailure
Definition: core-exceptions.hpp:29
helics::HelicsException
Definition: core-exceptions.hpp:18