lxcpp: provisioning implementation (part 1)
[platform/core/security/vasum.git] / libs / lxcpp / exception.hpp
index 1e3ce4c..37fec5a 100644 (file)
 
 namespace lxcpp {
 
-class ContainerException : std::runtime_error
-{
-public:
-    ContainerException(const std::string& what) : std::runtime_error(what) {}
+/**
+ * Base class for exceptions in lxcpp
+ */
+struct Exception: public std::runtime_error {
+    explicit Exception(const std::string& message)
+        : std::runtime_error(message) {}
+};
+
+struct NotImplementedException: public Exception {
+    explicit NotImplementedException(const std::string& message = "Functionality not yet implemented")
+        : Exception(message) {}
+};
+
+struct ProcessSetupException: public Exception {
+    explicit ProcessSetupException(const std::string& message = "Error while setting up a process")
+        : Exception(message) {}
+};
+
+struct FileSystemSetupException: public Exception {
+    explicit FileSystemSetupException(const std::string& message = "Error during a file system operation")
+        : Exception(message) {}
+};
+
+struct EnvironmentSetupException: public Exception {
+    explicit EnvironmentSetupException(const std::string& message = "Error during handling environment variables")
+        : Exception(message) {}
+};
+
+struct CredentialSetupException: public Exception {
+    explicit CredentialSetupException(const std::string& message = "Error during handling environment variables")
+        : Exception(message) {}
+};
+
+struct CapabilitySetupException: public Exception {
+    explicit CapabilitySetupException(const std::string& message = "Error during a capability operation")
+        : Exception(message) {}
+};
+
+struct UtilityException: public Exception {
+    explicit UtilityException(const std::string& message = "Error during an utility operation")
+        : Exception(message) {}
+};
+
+struct TerminalException: public Exception {
+    explicit TerminalException(const std::string& message = "Error during a terminal operation")
+        : Exception(message) {}
+};
+
+struct BadArgument: public Exception {
+    explicit BadArgument(const std::string& message = "Bad argument passed")
+        : Exception(message) {}
+};
+
+struct NoSuchValue: public Exception {
+    explicit NoSuchValue(const std::string& message = "Value not found")
+        : Exception(message) {}
+};
+
+struct NetworkException : public Exception {
+    explicit NetworkException (const std::string& message = "Error during setting up a network")
+        : Exception(message) {}
+};
+
+struct ConfigureException: public Exception {
+    explicit ConfigureException(const std::string& message = "Error while configuring a container")
+        : Exception(message) {}
 };
 
-class NotImplemented : ContainerException
-{
-public:
-    NotImplemented() : ContainerException(std::string()) {}
+struct ProvisionException: public Exception {
+    explicit ProvisionException(const std::string& message = "Provision error")
+        : Exception(message) {}
 };
 
 } // namespace lxcpp