Scine::Core  3.0.0
Module management and core interface definitions
 All Classes Files Functions Variables Typedefs Pages
Exceptions.h
Go to the documentation of this file.
1 
7 #ifndef CORE_EXCEPTIONS_H_
8 #define CORE_EXCEPTIONS_H_
9 /* External Includes */
10 #include <exception>
11 #include <stdexcept>
12 #include <string>
13 
14 namespace Scine {
15 namespace Utils {
16 class PropertyList;
17 }
18 namespace Core {
23 class SettingsKeyError : public std::exception {
24  const char* what() const noexcept override {
25  return "The key was not recognized in these settings.";
26  }
27 };
28 
33 class SettingsValueError : public std::exception {
34  const char* what() const noexcept override {
35  return "The value did not match the type defined by the given key.";
36  }
37 };
38 
43 class ClassNotImplementedError : public std::exception {
44  const char* what() const noexcept override {
45  return "No class with the requested name is implemented.";
46  }
47 };
48 
53 class FunctionNotImplementedError : public std::exception {
54  const char* what() const noexcept override {
55  return "This module does not provide the requested interface..";
56  }
57 };
58 
63 class StateCastingException : public std::exception {
64  const char* what() const noexcept final {
65  return "State pointer does not have a compatible underlying type.";
66  }
67 };
68 
73 class InvalidPropertiesException : public std::runtime_error {
74  public:
75  explicit InvalidPropertiesException(const Utils::PropertyList& /*unused*/)
76  : std::runtime_error("Calculator cannot calculate required properties.") {
77  }
78 };
79 
84 class CalculationException : public std::runtime_error {
85  protected:
87  explicit CalculationException(const std::string& s) : std::runtime_error(s) {
88  }
89 };
90 
96  public:
97  explicit InitializationException(const std::string& s) : CalculationException("Initialization error: " + s) {
98  }
99 };
100 
106  public:
108  : CalculationException("Cannot calculate properties for empty structure") {
109  }
110 };
111 
117  public:
118  explicit UnsuccessfulCalculationException(const std::string& s) : CalculationException(s) {
119  }
120 };
121 
127  public:
128  explicit StateSavingException(const std::string& s) : CalculationException("State-saving error: " + s) {
129  }
130 };
131 
132 } /* namespace Core */
133 } /* namespace Scine */
134 
135 #endif /* CORE_EXCEPTIONS_H_ */
Exception thrown when a problem arises in the calculator initialization.
Definition: Exceptions.h:95
Exception thrown when a calculation is unsuccessful.
Definition: Exceptions.h:116
An Exception for an error when generating classes through a module-interface.
Definition: Exceptions.h:43
Base class for exceptions thrown during calculations.
Definition: Exceptions.h:84
An Exception for an error when handling values in settings.
Definition: Exceptions.h:33
CalculationException(const std::string &s)
Definition: Exceptions.h:87
Exception thrown when one requires properties from a calculation which cannot be calculated.
Definition: Exceptions.h:73
Exception thrown for errors in state saving / resetting.
Definition: Exceptions.h:126
Exception to be thrown if the state cannot be cast to the desired type.
Definition: Exceptions.h:63
An Exception for an error when a function in a module-interface is not implemented.
Definition: Exceptions.h:53
Exception thrown when launching a calculation with an empty structure.
Definition: Exceptions.h:105
An Exception for an error when handling keys in settings.
Definition: Exceptions.h:23