/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (C) 2015 Samsung Electronics Co., Ltd All Rights Reserved
*
- * Contact: Mateusz Malicki <m.malicki2@samsung.com>
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
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